chore(deps): bump docker/build-push-action from 4.2.1 to 5.0.0 #126
Workflow file for this run
This file contains 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: CI/CD | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
permissions: | |
contents: read | |
concurrency: | |
group: ci-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
jobs: | |
test: | |
if: ${{ github.event_name == 'pull_request' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
command: | |
- 'check --all --locked' | |
- 'test --all --locked' | |
- 'clippy --all -- -D warnings' | |
- 'fmt --all -- --check' | |
runs-on: ubuntu-20.04 | |
name: Test on nightly-2022-07-24 ( ${{ matrix.command }} ) | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac | |
with: | |
fetch-depth: 0 | |
- name: Install protobuf-compiler | |
run: sudo apt install -y protobuf-compiler | |
- name: Install toolchain | |
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af | |
with: | |
profile: minimal | |
toolchain: nightly-2022-07-24 | |
components: clippy, rustfmt | |
target: wasm32-unknown-unknown | |
override: true | |
default: true | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@e207df5d269b42b69c8bc5101da26f7d31feddb4 | |
- name: Run cargo ${{ matrix.command }} | |
run: cargo ${{ matrix.command }} | |
build: | |
if: ${{ github.event_name == 'push' && github.ref_type == 'branch' }} | |
runs-on: ubuntu-20.04 | |
name: Build | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac | |
with: | |
fetch-depth: 0 | |
- name: Install protobuf-compiler | |
run: sudo apt install -y protobuf-compiler | |
- name: Install toolchain | |
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af | |
with: | |
profile: minimal | |
toolchain: nightly-2022-07-24 | |
components: clippy, rustfmt | |
target: wasm32-unknown-unknown | |
override: true | |
default: true | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@e207df5d269b42b69c8bc5101da26f7d31feddb4 | |
- name: Run cargo build | |
run: cargo build --release --locked | |
- name: Copy binnary file | |
run: cp target/release/debio . | |
- name: Send WASM to Discord | |
uses: tsickert/discord-webhook@c840d45a03a323fbc3f7507ac7769dbd91bfb164 | |
with: | |
webhook-url: ${{ secrets.DISCORD_WEBHOOK }} | |
embed-title: New WASM | |
embed-description: Build success on commit sha ${{ github.sha }} | |
filename: ./target/release/wbuild/debio-runtime/debio_runtime.compact.compressed.wasm | |
- name: Set Up QEMU | |
uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 | |
- name: Set Up Docker Buildx | |
id: set-up-buildx | |
uses: docker/setup-buildx-action@885d1462b80bc1c1c7f0b00334ad271f09369c55 | |
with: | |
install: true | |
- name: Cache Docker Layers | |
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Build Docker | |
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 | |
with: | |
builder: ${{ steps.set-up-buildx.outputs.name }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max | |
context: . | |
file: .maintain/docker/injected-binnary.Dockerfile | |
tags: ${{ github.repository }}:${{ github.sha }} | |
outputs: type=docker,dest=/tmp/docker_image.tar | |
- name: Move Cache Docker Layers | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | |
- name: Upload Build to Artifact | |
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 | |
with: | |
name: build_${{ github.sha }} | |
path: | | |
/tmp/docker_image.tar | |
retention-days: 5 | |
release-please: | |
needs: | |
- build | |
runs-on: ubuntu-20.04 | |
name: Release Please | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac | |
with: | |
fetch-depth: 0 | |
- name: Compute Version | |
id: compute-version | |
shell: bash | |
run: | | |
VERSION=$(sed -n '/^[[:space:]]spec_version:/p' ./runtime/src/lib.rs | sed -e 's/^[[:space:]]spec_version: \(.*\),/\1/') | |
MAJOR=${VERSION:0:2} | |
if [[ ${MAJOR:1:1} == "0" ]] | |
then | |
MAJOR=${MAJOR:0:1} | |
fi | |
MINOR=${VERSION:2:1} | |
PATCH=${VERSION:3:1} | |
echo "semver=$MAJOR.$MINOR.$PATCH" >> $GITHUB_OUTPUT | |
- name: Release | |
id: release | |
uses: google-github-actions/release-please-action@ca6063f4ed81b55db15b8c42d1b6f7925866342d | |
with: | |
token: ${{ secrets.PAT }} | |
fork: true | |
plugins: cargo-workspace | |
path: ./node | |
package-name: debio | |
release-type: rust | |
release-as: ${{ steps.compute-version.outputs.semver }} | |
include-v-in-tag: false | |
outputs: | |
release_created: ${{ steps.release.outputs.release_created }} | |
tag_name: ${{ steps.release.outputs.tag_name }} | |
publish-docker: | |
needs: | |
- release-please | |
runs-on: ubuntu-20.04 | |
name: Publish Docker | |
steps: | |
- name: Login to DockerHub | |
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Download Build from Artifact | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a | |
with: | |
name: build_${{ github.sha }} | |
path: /tmp | |
- name: Load Downloaded Image | |
run: | | |
docker load --input /tmp/docker_image.tar | |
docker images --no-trunc --digests ${{ github.repository }} | |
- name: Tag as Release Version | |
if: ${{ needs.release-please.outputs.release_created }} | |
run: | | |
docker tag ${{ github.repository }}:${{ github.sha }} ${{ github.repository }}:${{ needs.release-please.outputs.tag_name }} | |
docker tag ${{ github.repository }}:${{ github.sha }} ${{ github.repository }}:latest | |
docker images --no-trunc --digests ${{ github.repository }} | |
- name: Push | |
run: docker image push -a ${{ github.repository }} |