chore: fix Dockerfile. (#422)
#41
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 Sprocket | |
| on: | |
| push: | |
| tags: | |
| - v* | |
| env: | |
| REGISTRY: ghcr.io | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Update Rust | |
| run: rustup update stable && rustup default stable | |
| - name: Publish crates | |
| run: cargo --locked run -p ci --release --bin ci -- publish | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} | |
| docker-x86: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Update Rust | |
| run: rustup update stable && rustup default stable | |
| - name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/sprocket | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and push by digest | |
| id: build | |
| uses: docker/build-push-action@v6 | |
| with: | |
| platforms: linux/amd64 | |
| labels: ${{ steps.meta.outputs.labels }} | |
| tags: ${{ env.REGISTRY }}/${{ github.repository_owner }}/sprocket | |
| outputs: type=image,push-by-digest=true,name-canonical=true,push=true | |
| - name: Export digest | |
| run: | | |
| mkdir -p ${{ runner.temp }}/digests | |
| digest="${{ steps.build.outputs.digest }}" | |
| touch "${{ runner.temp }}/digests/${digest#sha256:}" | |
| - name: Upload digest | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: digests-x86 | |
| path: ${{ runner.temp }}/digests/* | |
| if-no-files-found: error | |
| retention-days: 1 | |
| docker-arm: | |
| runs-on: ubuntu-24.04-arm | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Update Rust | |
| run: rustup update stable && rustup default stable | |
| - name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/sprocket | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and push by digest | |
| id: build | |
| uses: docker/build-push-action@v6 | |
| with: | |
| platforms: linux/arm64 | |
| labels: ${{ steps.meta.outputs.labels }} | |
| tags: ${{ env.REGISTRY }}/${{ github.repository_owner }}/sprocket | |
| outputs: type=image,push-by-digest=true,name-canonical=true,push=true | |
| - name: Export digest | |
| run: | | |
| mkdir -p ${{ runner.temp }}/digests | |
| digest="${{ steps.build.outputs.digest }}" | |
| touch "${{ runner.temp }}/digests/${digest#sha256:}" | |
| - name: Upload digest | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: digests-arm | |
| path: ${{ runner.temp }}/digests/* | |
| if-no-files-found: error | |
| retention-days: 1 | |
| docker-merge-manifests: | |
| runs-on: ubuntu-latest | |
| needs: [docker-x86, docker-arm] | |
| steps: | |
| - name: Download digests | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: ${{ runner.temp }}/digests | |
| pattern: digests-* | |
| merge-multiple: true | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/sprocket | |
| tags: type=semver,pattern=v{{version}} | |
| labels: | | |
| org.opencontainers.image.source=https://github.com/${{ github.repository }} | |
| org.opencontainers.image.version=v{{version}} | |
| - name: Create manifest list and push | |
| working-directory: ${{ runner.temp }}/digests | |
| run: | | |
| docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ | |
| $(printf '${{ env.REGISTRY }}/${{ github.repository_owner }}/sprocket@sha256:%s ' *) | |
| - name: Inspect image | |
| run: | | |
| docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ github.repository_owner }}/sprocket:${{ steps.meta.outputs.version }} | |
| build_artifacts_win: | |
| runs-on: windows-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - rust-target: x86_64-pc-windows-msvc | |
| os: windows-latest | |
| extension: zip | |
| - rust-target: aarch64-pc-windows-msvc | |
| extension: zip | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Update Rust | |
| run: rustup update stable && rustup default stable && rustup target add ${{ matrix.rust-target }} | |
| - run: cargo --locked build --release --target ${{ matrix.rust-target }} | |
| - run: 7z a sprocket-${{ github.ref_name }}-${{ matrix.rust-target }}.zip sprocket.exe | |
| working-directory: ./target/${{ matrix.rust-target }}/release | |
| - name: Update the GH release with the new artifact | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: ./target/${{ matrix.rust-target }}/release/sprocket-${{ github.ref_name }}-${{ matrix.rust-target }}.${{ matrix.extension }} | |
| build_artifacts_mac: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - rust-target: x86_64-apple-darwin | |
| os: macos-latest | |
| extension: tar.gz | |
| - rust-target: aarch64-apple-darwin | |
| os: macos-latest | |
| extension: tar.gz | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Update Rust | |
| run: rustup update stable && rustup default stable && rustup target add ${{ matrix.rust-target }} | |
| - run: brew install openssl pkg-config | |
| - run: PKG_CONFIG_SYSROOT_DIR=/ cargo --locked build --release --target ${{ matrix.rust-target }} | |
| - run: tar -czvf sprocket-${{ github.ref_name }}-${{ matrix.rust-target }}.tar.gz sprocket | |
| working-directory: ./target/${{ matrix.rust-target }}/release | |
| - name: Update the GH release with the new artifact | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: ./target/${{ matrix.rust-target }}/release/sprocket-${{ github.ref_name }}-${{ matrix.rust-target }}.${{ matrix.extension }} | |
| build_artifacts_linux: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - rust-target: x86_64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| extension: tar.gz | |
| - rust-target: aarch64-unknown-linux-gnu | |
| os: ubuntu-24.04-arm | |
| extension: tar.gz | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Update Rust | |
| run: rustup update stable && rustup default stable && rustup target add ${{ matrix.rust-target }} | |
| - run: sudo apt-get install pkg-config libssl-dev | |
| - run: PKG_CONFIG_SYSROOT_DIR=/ cargo --locked build --release --target ${{ matrix.rust-target }} | |
| - run: tar -czvf sprocket-${{ github.ref_name }}-${{ matrix.rust-target }}.tar.gz sprocket | |
| working-directory: ./target/${{ matrix.rust-target }}/release | |
| - name: Update the GH release with the new artifact | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: ./target/${{ matrix.rust-target }}/release/sprocket-${{ github.ref_name }}-${{ matrix.rust-target }}.${{ matrix.extension }} |