Skip to content

Create Release

Create Release #11

Workflow file for this run

name: Create Release
on:
workflow_dispatch
jobs:
create-tag:
name: "Create tag from package.json"
runs-on: ubuntu-latest
outputs:
version: ${{ steps.create-tag.outputs.version }}
tag: ${{ steps.create-tag.outputs.tag }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create Git tag
id: create-tag
run: |
version="$(jq -r '.version' package.json)"
tag="v$version"
git tag $tag
git push origin $tag
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "tag=$tag" >> "$GITHUB_OUTPUT"
github-release:
needs:
- create-tag
name: "Create GitHub release"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create changelog
id: changelog
uses: loopwerk/tag-changelog@v1.1.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
config_file: .github/tag-changelog.cjs
- name: Create release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{needs.create-tag.outputs.tag}}
name: Release ${{needs.create-tag.outputs.tag}}
body: ${{ steps.changelog.outputs.changes }}
release-docker:
needs:
- create-tag
name: "Build & Release docker image (tag)"
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Log in to the GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ github.repository }}
ghcr.io/${{ github.repository }}
tags: |
type=raw,value=latest
type=semver,pattern={{version}},value=${{needs.create-tag.outputs.version}}
type=semver,pattern={{major}}.{{minor}},value=${{needs.create-tag.outputs.version}}
- name: Build and push Docker images
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}