Merge pull request #4 from zeabur/upgrade-dependencies-0723 #26
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: Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| pull_request: | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: "Version tag to release (e.g. v1.2.3 or v1.2.3-dev.1)" | |
| required: true | |
| type: string | |
| permissions: | |
| contents: read | |
| actions: write | |
| concurrency: | |
| group: release-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| jobs: | |
| build: | |
| name: Build (linux/amd64) | |
| runs-on: blacksmith-2vcpu-ubuntu-2404 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0 | |
| - name: Build | |
| uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0 | |
| with: | |
| platforms: linux/amd64 | |
| push: false | |
| prepare: | |
| name: Prepare release metadata | |
| runs-on: blacksmith-2vcpu-ubuntu-2404 | |
| if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) || github.event_name == 'workflow_dispatch' | |
| outputs: | |
| version: ${{ steps.version.outputs.value }} | |
| dockerhub-tags: ${{ steps.dockerhub.outputs.tags }} | |
| swr-tags: ${{ steps.swr.outputs.tags }} | |
| steps: | |
| - name: Resolve tag | |
| id: tag | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| echo "value=${{ github.event.inputs.tag }}" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "value=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Extract version | |
| id: version | |
| run: | | |
| TAG="${{ steps.tag.outputs.value }}" | |
| echo "value=${TAG#v}" >> "$GITHUB_OUTPUT" | |
| - name: Docker Hub metadata | |
| id: dockerhub | |
| uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0 | |
| with: | |
| images: docker.io/zeabur/stratus | |
| flavor: latest=auto | |
| tags: | | |
| type=semver,pattern={{version}},value=${{ steps.tag.outputs.value }} | |
| type=semver,pattern={{major}}.{{minor}},value=${{ steps.tag.outputs.value }} | |
| type=semver,pattern={{major}},value=${{ steps.tag.outputs.value }} | |
| - name: SWR metadata | |
| id: swr | |
| uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0 | |
| with: | |
| images: swr.cn-east-3.myhuaweicloud.com/zeabur/stratus | |
| flavor: latest=auto | |
| tags: | | |
| type=semver,pattern={{version}},value=${{ steps.tag.outputs.value }} | |
| type=semver,pattern={{major}}.{{minor}},value=${{ steps.tag.outputs.value }} | |
| type=semver,pattern={{major}},value=${{ steps.tag.outputs.value }} | |
| build-release-dockerhub: | |
| name: Build (dockerhub, linux/${{ matrix.arch }}) | |
| runs-on: ${{ matrix.runner }} | |
| needs: [build, prepare] | |
| strategy: | |
| matrix: | |
| include: | |
| - arch: amd64 | |
| platform: linux/amd64 | |
| runner: blacksmith-2vcpu-ubuntu-2404 | |
| - arch: arm64 | |
| platform: linux/arm64 | |
| runner: blacksmith-2vcpu-ubuntu-2404-arm | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4.4.0 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build and push | |
| uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0 | |
| with: | |
| platforms: ${{ matrix.platform }} | |
| provenance: "true" | |
| push: true | |
| tags: docker.io/zeabur/stratus:${{ needs.prepare.outputs.version }}-linux-${{ matrix.arch }} | |
| build-release-swr: | |
| name: Build (swr, linux/${{ matrix.arch }}) | |
| runs-on: ${{ matrix.runner }} | |
| needs: [build, prepare] | |
| strategy: | |
| matrix: | |
| include: | |
| - arch: amd64 | |
| platform: linux/amd64 | |
| runner: blacksmith-2vcpu-ubuntu-2404 | |
| - arch: arm64 | |
| platform: linux/arm64 | |
| runner: blacksmith-2vcpu-ubuntu-2404-arm | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0 | |
| - name: Login to Huawei SWR | |
| uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4.4.0 | |
| with: | |
| registry: swr.cn-east-3.myhuaweicloud.com | |
| username: ${{ secrets.HUAWEI_SWR_USERNAME }} | |
| password: ${{ secrets.HUAWEI_SWR_TOKEN }} | |
| - name: Build and push | |
| uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0 | |
| with: | |
| platforms: ${{ matrix.platform }} | |
| provenance: "false" | |
| push: true | |
| tags: swr.cn-east-3.myhuaweicloud.com/zeabur/stratus:${{ needs.prepare.outputs.version }}-linux-${{ matrix.arch }} | |
| push-dockerhub: | |
| name: Push to Docker Hub | |
| runs-on: blacksmith-2vcpu-ubuntu-2404-arm | |
| needs: [prepare, build-release-dockerhub] | |
| steps: | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4.4.0 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Create multi-arch manifest | |
| run: | | |
| VERSION="${{ needs.prepare.outputs.version }}" | |
| readarray -t TAGS < <(echo "${{ needs.prepare.outputs.dockerhub-tags }}") | |
| TAG_ARGS=() | |
| for t in "${TAGS[@]}"; do TAG_ARGS+=(-t "$t"); done | |
| docker buildx imagetools create "${TAG_ARGS[@]}" \ | |
| docker.io/zeabur/stratus:${VERSION}-linux-amd64 \ | |
| docker.io/zeabur/stratus:${VERSION}-linux-arm64 | |
| push-swr: | |
| name: Push to Huawei SWR | |
| runs-on: blacksmith-2vcpu-ubuntu-2404-arm | |
| needs: [prepare, build-release-swr] | |
| steps: | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0 | |
| - name: Login to Huawei SWR | |
| uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4.4.0 | |
| with: | |
| registry: swr.cn-east-3.myhuaweicloud.com | |
| username: ${{ secrets.HUAWEI_SWR_USERNAME }} | |
| password: ${{ secrets.HUAWEI_SWR_TOKEN }} | |
| - name: Create multi-arch manifest | |
| run: | | |
| VERSION="${{ needs.prepare.outputs.version }}" | |
| readarray -t TAGS < <(echo "${{ needs.prepare.outputs.swr-tags }}") | |
| TAG_ARGS=() | |
| for t in "${TAGS[@]}"; do TAG_ARGS+=(-t "$t"); done | |
| docker buildx imagetools create "${TAG_ARGS[@]}" \ | |
| swr.cn-east-3.myhuaweicloud.com/zeabur/stratus:${VERSION}-linux-amd64 \ | |
| swr.cn-east-3.myhuaweicloud.com/zeabur/stratus:${VERSION}-linux-arm64 |