fix: attempt to fix badges #5
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: Substrate publisher image build and release automation workflow | |
on: | |
push: | |
tags: | |
- '*' | |
branches: | |
- main | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build-and-push-publisher: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
# Set the list of tags for the Docker image | |
tags: | | |
type=ref,event=tag | |
type=raw,value=latest | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./ | |
file: ./docker/Dockerfile | |
# No need for build args at the build time, will be set at the runtime | |
# build_args: | | |
# NATS=${{ vars.NATS }} | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
create-release: | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
needs: build-and-push-publisher | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Create package.json with latest tag | |
run: | | |
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`) | |
previous_tag=$(git describe --tags --abbrev=0 HEAD^) | |
echo "Latest tag is $latest_tag" | |
echo "Previous tag is $previous_tag" | |
echo "{\"version\": \"${latest_tag#v}\"}" > package.json | |
echo "LATEST_TAG=${latest_tag}" >> $GITHUB_ENV | |
echo "PREVIOUS_TAG=${previous_tag}" >> $GITHUB_ENV | |
- name: "Generate release changelog" | |
id: changelog | |
uses: heinrichreimer/[email protected] | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
unreleased: false | |
onlyLastTag: true | |
# sinceTag: ${{ env.PREVIOUS_TAG }} | |
dueTag: ${{ env.LATEST_TAG }} | |
output: "CHANGELOG.md" | |
dateFormat: "%Y-%m-%d" | |
- name: Tidy up the changelog | |
run: sed -i '$ d' CHANGELOG.md | |
- name: Print the changelog | |
run: cat CHANGELOG.md | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag_name: ${{ env.LATEST_TAG }} | |
body_path: CHANGELOG.md | |
draft: false | |
prerelease: false | |
files: | | |
CHANGELOG.md |