chore: release 0.5.3 #3
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: Publish stable | |
on: | |
push: | |
branches: | |
- "release/stable/**" | |
pull_request: | |
branches: | |
- "release/stable/**" | |
types: [opened, synchronize] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
release_image: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
# Install buildx | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
# Set buildx cache | |
- name: Cache register | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: buildx-cache | |
# Login to ghcr.io | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.BOT_USERNAME }} | |
password: ${{ secrets.BOT_TOKEN }} | |
# Extract branch info | |
- name: Set info | |
run: | | |
echo "CHANNEL=$(echo ${GITHUB_REF} | awk -F/ '{print $4}')" >> $GITHUB_ENV | |
echo "VERSION=$(echo ${GITHUB_REF} | awk -F/ '{print $5}')" >> $GITHUB_ENV | |
# Print info for debug | |
- name: Print Info | |
run: | | |
echo $CHANNEL | |
echo $VERSION | |
# Create buildx multiarch | |
- name: Create buildx multiarch | |
run: | | |
docker buildx create \ | |
--use \ | |
--name=buildx-multi-arch \ | |
--driver=docker-container \ | |
--driver-opt=network=host | |
# Build image | |
- name: Build image | |
run: | | |
docker buildx build \ | |
--builder=buildx-multi-arch \ | |
--platform=linux/amd64,linux/arm/v7,linux/arm64 \ | |
--label org.opencontainers.image.source=https://github.com/next-hat/metrs \ | |
-t ghcr.io/next-hat/metrsd:$VERSION \ | |
-t ghcr.io/next-hat/metrsd:latest \ | |
-f ./Dockerfile . \ | |
--push | |
# Upload it to release | |
- name: Test if release already exists | |
id: release-exists | |
continue-on-error: true | |
run: gh release view $VERSION | |
env: | |
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} | |
- name: Create new draft release | |
if: steps.release-exists.outcome == 'failure' && steps.release-exists.conclusion == 'success' | |
run: gh release create -t $VERSION -d $VERSION -F ./bin/metrsd/CHANGELOG.md | |
env: | |
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} |