Update version files to v2.1.1 #10
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: FNOS | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - UGREEN | |
| paths: | |
| - fn_version | |
| jobs: | |
| build-frontend: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout frontend code | |
| uses: actions/checkout@v3 | |
| with: | |
| repository: onlyLTY/dockerCopilotWeb | |
| path: './frontend' | |
| ref: 'main' | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| cache-dependency-path: | | |
| frontend/package-lock.json | |
| frontend/package.json | |
| - name: Build Frontend | |
| run: | | |
| cd frontend | |
| npm ci | |
| npm run build | |
| - name: Upload Frontend Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: my-artifact-front-dist | |
| path: frontend/dist | |
| build-backend: | |
| needs: [ build-frontend ] | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| arch: [ amd64, arm64 ] | |
| steps: | |
| - name: Checkout code back end | |
| uses: actions/checkout@v3 | |
| - name: Download Frontend Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: my-artifact-front-* | |
| merge-multiple: true | |
| path: front | |
| - run: ls -R front | |
| - name: Get version from file | |
| id: get_version | |
| run: | | |
| echo "version=$(cat fn_version)" >> $GITHUB_ENV | |
| - name: Cache Go Modules | |
| uses: actions/cache@v3 | |
| with: | |
| path: ${{ github.workspace }}/msaber-back/pkg/mod | |
| key: go-mod-${{ hashFiles('**/go.sum') }} | |
| restore-keys: | | |
| go-mod- | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: '1.23.4' | |
| cache: false | |
| - name: Build for ${{ matrix.arch }} | |
| run: | | |
| CGO_ENABLED=0 GOOS=linux GOARCH=${{ matrix.arch }} go build -a --trimpath -ldflags="-w -s -X 'github.com/onlyLTY/dockerCopilot/internal/config.Version=${{ env.version }}' -X 'github.com/onlyLTY/dockerCopilot/internal/config.BuildDate=$(date)'" -o dist/linux/${{ matrix.arch }}/dockerCopilot-new . | |
| - name: Compress binary | |
| run: | | |
| tar -czvf dockerCopilot-${{ matrix.arch }}.tar.gz dist/linux/${{ matrix.arch }}/dockerCopilot-new | |
| - name: List current directory | |
| run: ls -la | |
| - name: Check if release already exists | |
| id: check_release | |
| run: | | |
| exists=$(gh release view ${{ env.version }} 2>&1 | grep "release not found" || true) | |
| if [[ -z "$exists" ]]; then | |
| echo "Release exists" | |
| echo "RELEASE_EXISTS=true" >> $GITHUB_ENV | |
| else | |
| echo "Release does not exist" | |
| echo "RELEASE_EXISTS=false" >> $GITHUB_ENV | |
| fi | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create GitHub Release if not exists | |
| if: env.RELEASE_EXISTS == 'false' | |
| run: | | |
| gh release create ${{ env.version }} \ | |
| --title "${{ env.version }}" \ | |
| --notes "Release of version ${{ env.version }}" | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload Asset for ${{ matrix.arch }} | |
| run: | | |
| gh release upload ${{ env.version }} dockerCopilot-${{ matrix.arch }}.tar.gz | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |