bumped version to v0.2.14 and added changelog #20
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: Build and Release | |
on: | |
push: | |
tags: | |
- 'v*.*.*' | |
env: | |
CARGO_TERM_COLOR: always | |
IMAGE_NAME: systemd-fail-notifications | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: install nix | |
uses: cachix/install-nix-action@v22 | |
- name: get the version | |
id: get_version | |
if: startsWith(github.ref, 'refs/tags/') | |
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/} | |
- name: execute checks | |
run: nix flake check | |
- name: build container image | |
run: nix build .#systemd-fail-notifications-image | |
- name: load image into docker | |
run: docker load < result | |
- name: test run with help-output | |
run: docker run systemd-fail-notifications:latest --help | |
- name: Log in to 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 | |
# 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 ${{ steps.get_version.outputs.VERSION }} | sed -e 's/^v//') | |
echo IMAGE_ID=$IMAGE_ID | |
echo VERSION=$VERSION | |
# Tag with full semantic version and also set it as latest | |
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION | |
docker push $IMAGE_ID:$VERSION | |
docker tag $IMAGE_NAME $IMAGE_ID:latest | |
docker push $IMAGE_ID:latest | |
# Tag with only major and minor (i.e. without the last number) | |
VERSION=${VERSION%.*} | |
echo VERSION=$VERSION | |
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION | |
docker push $IMAGE_ID:$VERSION | |
# Tag with only major | |
VERSION=${VERSION%.*} | |
echo VERSION=$VERSION | |
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION | |
docker push $IMAGE_ID:$VERSION | |
- name: build static binary | |
run: nix build .#systemd-fail-notifications | |
- name: release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: result/bin/systemd-fail-notifications | |
body_path: changelogs/${{ steps.get_version.outputs.VERSION }}.md | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |