.github/workflows/build_pre_release.yaml #11
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
| on: | |
| workflow_dispatch: | |
| inputs: | |
| TAG: | |
| description: 'The tag to use, defaults to VERSION-BUILD' | |
| required: false | |
| type: string | |
| BUILD: | |
| description: 'The build number to use' | |
| required: false | |
| type: number | |
| default: 1 | |
| env: | |
| REGISTRY: ${{ vars.DOCKERHUB_REGISTRY }} | |
| TAG: ${{ inputs.TAG }} | |
| jobs: | |
| draft: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Define TAG | |
| if: ${{ !inputs.TAG }} | |
| run: echo "TAG=$(cat VERSION)-${{ inputs.BUILD }}" >> $GITHUB_ENV | |
| - name: Update version in RELEASE.md | |
| shell: bash | |
| run: | | |
| sed -i 's|#{GIT_TAG_NAME}|${{ env.TAG }}|g' RELEASE.md | |
| - name: Create draft release | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| tag: ${{ env.TAG }} | |
| name: ${{ env.TAG }} | |
| bodyFile: RELEASE.md | |
| draft: true | |
| generateReleaseNotes: true | |
| removeArtifacts: true | |
| docker-build: | |
| needs: [draft] | |
| runs-on: ${{ matrix.runs_on }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - runs_on: ubuntu-24.04-arm | |
| arch: arm64 | |
| - runs_on: ubuntu-24.04 | |
| arch: amd64 | |
| env: | |
| ARCH: ${{ matrix.arch }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v2 | |
| - name: Define TAG | |
| if: ${{ !inputs.TAG }} | |
| run: echo "TAG=$(cat VERSION)-${{ inputs.BUILD }}" >> $GITHUB_ENV | |
| # Compile and release | |
| - name: Compile and release for ${{matrix.arch}} | |
| run: | |
| ./release.bash "${{ env.REGISTRY }}:${{ env.TAG }}" build-tgz build-image | |
| # Push to DockerHub | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Run docker push for ${{matrix.arch}} | |
| run: | |
| ./release.bash "${{ env.REGISTRY }}:${{ env.TAG }}" push-image | |
| # Upload files to draft release | |
| - name: Upload files to draft release | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| tag: ${{ env.TAG }} | |
| artifacts: release/*.tgz | |
| allowUpdates: true | |
| updateOnlyUnreleased: true | |
| omitBodyDuringUpdate: true | |
| omitNameDuringUpdate: true | |
| omitDraftDuringUpdate: true | |
| client-build: | |
| needs: [draft] | |
| runs-on: ${{ matrix.runs_on }} | |
| continue-on-error: ${{ matrix.continue-on-error || false }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - runs_on: ubuntu-24.04-arm | |
| arch: arm64 | |
| - runs_on: ubuntu-24.04 | |
| arch: amd64 | |
| - runs_on: ubuntu-24.04-arm | |
| arch: arm32 | |
| continue-on-error: true | |
| env: | |
| ARCH: ${{ matrix.arch }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v2 | |
| - name: Define TAG | |
| if: ${{ !inputs.TAG }} | |
| run: echo "TAG=$(cat VERSION)-${{ inputs.BUILD }}" >> $GITHUB_ENV | |
| # Compile the client | |
| - name: Run client for ${{matrix.arch}} | |
| continue-on-error: ${{ matrix.continue_on_error || false }} | |
| run: ./release.bash "${{ env.REGISTRY }}:${{ env.TAG }}" client-tgz | |
| # Upload files to draft release | |
| - name: Upload files to draft release | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| tag: ${{ env.TAG }} | |
| artifacts: release/*.tgz | |
| allowUpdates: true | |
| updateOnlyUnreleased: true | |
| omitBodyDuringUpdate: true | |
| omitNameDuringUpdate: true | |
| omitDraftDuringUpdate: true | |
| prerelease: | |
| runs-on: ubuntu-latest | |
| needs: [client-build, docker-build] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Define TAG | |
| if: ${{ !inputs.TAG }} | |
| run: echo "TAG=$(cat VERSION)-${{ inputs.BUILD }}" >> $GITHUB_ENV | |
| # Update docker manifest | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Create manifest | |
| run: | |
| ./release.bash "${{ env.REGISTRY }}:${{ env.TAG }}" manifest beta | |
| # Create pre-release | |
| - name: Make release as pre-release | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| tag: ${{ env.TAG }} | |
| prerelease: true | |
| allowUpdates: true | |
| updateOnlyUnreleased: true | |
| omitBodyDuringUpdate: true | |
| omitNameDuringUpdate: true |