ci(release): release github action #1
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
| permissions: | |
| contents: write | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-24.04 | |
| platform: linux | |
| arch: amd64 | |
| - os: ubuntu-24.04-arm | |
| platform: linux | |
| arch: arm64 | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust stable | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Build binary | |
| run: cargo build --release | |
| - name: Rename binary executable | |
| run: mv target/release/mikupush-server target/release/mikupush-server-${{ matrix.platform }}-${{ matrix.arch }} | |
| - uses: actions/upload-artifact@v4 | |
| name: Upload Artifacts | |
| with: | |
| name: ${{ matrix.arch }}-executable | |
| path: target/release/mikupush-server-${{ matrix.platform }}-${{ matrix.arch }} | |
| release: | |
| needs: | |
| - build | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: release-artifacts | |
| - name: Resolve version | |
| id: version | |
| run: echo "current=$(cat VERSION)" >> $GITHUB_ENV | |
| - name: Create tag | |
| run: | | |
| git tag ${{ steps.version.outputs.current }} | |
| git push --tags | |
| - name: Create Release | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| draft: true | |
| name: ${{ steps.version.outputs.current }} | |
| tag: ${{ steps.version.outputs.current }} | |
| artifacts: 'release-artifacts/*' | |
| docker-image: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Resolve version | |
| id: version | |
| run: echo "current=$(cat VERSION)" >> $GITHUB_ENV | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
| push: true | |
| tags: mikupush/server:${{ steps.version.outputs.current }},mikupush/server:latest |