Skip to content

Relayer using signing rules as backend (#608) #330

Relayer using signing rules as backend (#608)

Relayer using signing rules as backend (#608) #330

Workflow file for this run

name: Container Image Release
on:
push:
# Publish `develop` as Container `edge` image.
branches:
- develop
# Publish `v1.2.3` tags as releases.
tags:
- v*
env:
IMAGE_NAME: relayer
DEV_PACKAGES: build-essential musl musl-dev musl-tools libssl-dev pkg-config
jobs:
# This job downloads and stores `cross` as an artifact, so that it can be
# redownloaded across all of the jobs. Currently this copied pasted between
# `ci.yml` and `release.yml`. Make sure to update both places when making
# changes.
install-cross:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v1
with:
fetch-depth: 50
- uses: XAMPPRocky/get-github-release@v1
id: cross
with:
owner: rust-embedded
repo: cross
matches: ${{ matrix.platform }}
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v1
with:
name: cross-${{ matrix.platform }}
path: ${{ steps.cross.outputs.install_path }}
strategy:
matrix:
platform: [linux-musl]
push:
runs-on: ubuntu-latest
if: github.event_name == 'push'
needs: install-cross
permissions:
packages: write
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-push
cancel-in-progress: true
steps:
- name: install system build dependencies
run: sudo apt-get update && sudo apt-get install ${DEV_PACKAGES}
- uses: actions/checkout@v2
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
shared-key: "rust"
- name: Download Cross
uses: actions/download-artifact@v1
with:
name: cross-linux-musl
path: /tmp/
- run: chmod +x /tmp/cross
- run: ci/set_rust_version.bash stable x86_64-unknown-linux-musl
- run: ci/build.bash /tmp/cross x86_64-unknown-linux-musl RELEASE DOCKER
- name: Build Image
run: docker build . --file Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}"
- name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Push image
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `edge` tag convention
[ "$VERSION" == "develop" ] && VERSION=edge
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION