chore: Bump version for release #42
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: | |
| jobs: | |
| build: | |
| name: Build release artifacts | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-22.04 | |
| relname: x86_64-linux | |
| - os: ubuntu-22.04-arm | |
| relname: arm64-linux | |
| - os: macos-latest | |
| relname: arm64-darwin | |
| - os: macos-15-intel | |
| relname: x86_64-darwin | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock', 'rust-toolchain.toml') }}-1 | |
| - name: Setup environment variables | |
| run: | | |
| echo "RUSTFLAGS=--remap-path-prefix=${GITHUB_WORKSPACE}=/builds/dfinity" >> $GITHUB_ENV | |
| ver="v$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name=="icp-cli-network-launcher") | .version')" | |
| echo "VER=$ver" >> "$GITHUB_ENV" | |
| - name: Verify version tag | |
| if: ${{ github.ref_type == 'tag' }} | |
| run: | | |
| if [ "${GITHUB_REF_NAME}" != "${VER}" ]; then | |
| echo "Tag ${GITHUB_REF_NAME} does not match package version ${VER}" | |
| exit 1 | |
| fi | |
| - name: Build and package | |
| run: ./package.sh | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| if: ${{ github.ref_type == 'tag' }} | |
| with: | |
| name: icp-cli-network-launcher-${{ matrix.relname }}-${{ env.VER }} | |
| path: dist/icp-cli-network-launcher-${{ matrix.relname }}-${{ env.VER }}.tar.gz | |
| aggregate: | |
| name: build:required | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: ${{ always() }} | |
| steps: | |
| - if: ${{ needs.build.result != 'success' }} | |
| run: exit 1 | |
| release: | |
| name: Create release | |
| if: ${{ github.ref_type == 'tag' }} | |
| needs: build | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| relname: [x86_64-linux, arm64-linux, arm64-darwin, x86_64-darwin] | |
| steps: | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: icp-cli-network-launcher-${{ matrix.relname }}-${{ github.ref_name }} | |
| - name: Upload tarball and sha256 | |
| uses: svenstaro/upload-release-action@v2 | |
| with: | |
| repo_token: ${{ secrets.GITHUB_TOKEN }} | |
| file: icp-*.tar.* | |
| file_glob: true | |
| tag: ${{ github.ref_name }} | |
| prerelease: true | |
| make_latest: false | |
| docker-build: | |
| name: "Build Docker image for ${{ matrix.platform }}" | |
| if: ${{ github.ref_type == 'tag' }} | |
| runs-on: ${{ matrix.runner }} | |
| permissions: | |
| contents: read | |
| packages: write | |
| strategy: | |
| matrix: | |
| include: | |
| - platform: linux/amd64 | |
| runner: ubuntu-latest | |
| arch_tag: amd64 | |
| cache_suffix: cache-amd64 | |
| - platform: linux/arm64 | |
| runner: ubuntu-22.04-arm | |
| arch_tag: arm64 | |
| cache_suffix: cache-arm64 | |
| steps: | |
| - name: "Checkout code" | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: "Docker metadata" | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: | | |
| ghcr.io/${{ github.repository }} | |
| tags: | | |
| type=ref,event=branch | |
| type=ref,event=pr | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=raw,value=${{ github.sha }},enable=true | |
| - name: "Log in to GitHub Container Registry" | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: "Set up Docker Buildx" | |
| uses: docker/setup-buildx-action@v3 | |
| with: | |
| install: true | |
| - name: "Build and push ${{ matrix.platform }} image" | |
| id: build | |
| uses: docker/build-push-action@v6 | |
| with: | |
| push: true | |
| platforms: ${{ matrix.platform }} | |
| tags: | | |
| ghcr.io/${{ github.repository }}:${{ matrix.arch_tag }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=registry,ref=ghcr.io/${{ github.repository }}:${{ matrix.cache_suffix }} | |
| cache-to: type=registry,ref=ghcr.io/${{ github.repository }}:${{ matrix.cache_suffix }},mode=max,platform=${{ matrix.platform }} | |
| build-args: | | |
| BUILDKIT_INLINE_CACHE=1 | |
| docker-manifest: | |
| name: "Create and push multi-arch manifest" | |
| if: ${{ github.ref_type == 'tag' }} | |
| needs: docker-build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: "Checkout code" | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: "Docker metadata" | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: | | |
| ghcr.io/${{ github.repository }} | |
| tags: | | |
| type=ref,event=branch | |
| type=ref,event=pr | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=raw,value=${{ github.sha }},enable=true | |
| - name: "Log in to GitHub Container Registry" | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: "Create and push multi-arch manifest" | |
| uses: int128/docker-manifest-create-action@v2.8.0 | |
| with: | |
| tags: ${{ steps.meta.outputs.tags }} | |
| sources: | | |
| ghcr.io/${{ github.repository }}:amd64 | |
| ghcr.io/${{ github.repository }}:arm64 |