Skip to content

ci: ensure proper changelog generation #25

ci: ensure proper changelog generation

ci: ensure proper changelog generation #25

Workflow file for this run

name: release
on:
push:
tags:
- 'v*'
branches:
- "main"
permissions:
contents: write
packages: write
env:
REGISTRY: docker.io
REPOSITORY: linode
IMAGE: linode-cosi-driver
jobs:
changelog:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4
with:
fetch-tags: true
- name: Capture latest tag if exists
uses: actions-ecosystem/action-get-latest-tag@v1
id: get-latest-tag
with:
semver_only: true
with_initial_version: true
initial_version: v0.0.0
- id: previous
run: |
echo tag="$(git tag -l 'v*' | grep -v '${{ steps.get-latest-tag.outputs.tag }}' | tail -n 1)" >> "$GITHUB_OUTPUT"
- id: semver_parser
uses: release-kit/semver@v2
with:
string: ${{ github.ref_name }}
- id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
fromTag: ${{ steps.previous.outputs.tag }}
toTag: ${{ github.ref_name }}
excludeTypes: ""
excludeScopes: ""
- uses: ncipollo/[email protected]
with:
allowUpdates: true
draft: false
makeLatest: ${{ steps.semver_parser.outputs.prerelease == '' }}
prerelease: ${{ steps.semver_parser.outputs.prerelease != '' }}
name: ${{ github.ref_name }}
body: ${{ steps.changelog.outputs.changes }}
token: ${{ github.token }}
image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Capture latest tag if exists
uses: actions-ecosystem/action-get-latest-tag@v1
id: get-latest-tag
with:
semver_only: true
with_initial_version: true
initial_version: v0.0.0
- id: tags
run: |
./scripts/tags.sh \
"${{ env.REGISTRY }}/${{ env.REPOSITORY }}/${{ env.IMAGE }}" \
"${{ github.sha }}" \
"${{ github.ref_name }}" \
"${{ steps.get-latest-tag.outputs.tag }}" \
"${GITHUB_OUTPUT}"
- uses: docker/build-push-action@v6
with:
push: ${{ startsWith(github.ref, 'refs/tags/v') || (github.ref == 'refs/heads/main') }}
load: ${{ !(startsWith(github.ref, 'refs/tags/v') || (github.ref == 'refs/heads/main')) }}
tags: ${{ steps.tags.outputs.all }}
build-args: |
VERSION=${{ steps.tags.outputs.version }}
target: runtime
- name: Scan image using Grype
id: grype
uses: anchore/scan-action@v5
with:
image: ${{ steps.tags.outputs.full_version }}
output-format: table