This repository has been archived by the owner on Aug 24, 2023. It is now read-only.
bump(deps): update rust crate serde to 1.0.186 #510
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: CD | |
on: | |
release: | |
types: [published] | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
main: | |
if: github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' | |
name: Publish | |
runs-on: ubuntu-latest | |
environment: Release Docker | |
steps: | |
- uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 # v1.1.2 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Checkout | |
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # v2.1.0 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@8c0edbc76e98fa90f69d9a2c020dcb50019dc325 # v2.2.1 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Tags | |
uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0 # v6.3.3 | |
id: tags | |
with: | |
script: | | |
const prefix = 'ghcr.io/defich/metachain' | |
if (context.eventName === 'release') { | |
const semver = context.payload?.release?.tag_name | |
if (semver.match(/^v[0-9]+\.[0-9]+\.[0-9]+$/) === null) { | |
throw new Error(`Release Violation: Provided version '${semver}' is not valid semver.`) | |
} | |
return `${prefix}:latest,${prefix}:${semver.replace('v','')}` | |
} | |
if (context.eventName === 'push' && context.ref === 'refs/heads/main') { | |
return `${prefix}:main,${prefix}:${context.sha}` | |
} | |
if (context.eventName === 'pull_request') { | |
return `${prefix}:${context.payload.number},${prefix}:${context.sha}` | |
} | |
result-encoding: string | |
- name: Build & Publish | |
uses: docker/build-push-action@c56af957549030174b10d6867f20e78cfd7debc5 # v3.2.0 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
platforms: | | |
linux/amd64 | |
# linux/arm64 TODO: enable after we can limit parallelization to 1 | |
tags: ${{ steps.tags.outputs.result }} | |
cache-from: type=registry,ref=ghcr.io/defich/metachain:buildcache | |
cache-to: type=registry,ref=ghcr.io/defich/metachain:buildcache,mode=max | |
- name: Post Report | |
if: github.event_name == 'pull_request' | |
uses: marocchino/sticky-pull-request-comment@fcf6fe9e4a0409cd9316a5011435be0f3327f1e1 # v2.3.1 | |
with: | |
header: release | |
message: | | |
Docker image for defich/metachain is ready! | |
Built with commit ${{ github.sha }} | |
- `docker pull ghcr.io/defich/metachain:${{ github.sha }}` | |
- `docker pull ghcr.io/defich/metachain:pr-${{ github.event.number }}` |