Update Tangle chainIds (#35) #20
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: Container Image Release | |
on: | |
push: | |
# Publish `main` as Container `edge` image. | |
branches: | |
- main | |
# Publish `v1.2.3` tags as releases. | |
tags: | |
- v* | |
env: | |
IMAGE_NAME: faucet | |
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/[email protected] | |
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 | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- 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" | |
cache-directories: ".dvc/tmp\n.dvc/cache" | |
- 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" == "main" ] && VERSION=edge | |
echo IMAGE_ID=$IMAGE_ID | |
echo VERSION=$VERSION | |
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION | |
docker push $IMAGE_ID:$VERSION |