Skip to content

ci: bump action versions and ignore tag push #104

ci: bump action versions and ignore tag push

ci: bump action versions and ignore tag push #104

Workflow file for this run

name: Build
on:
push:
branches:
- '**'
tags-ignore:
- '**'
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
with:
# Fetches entire history, so we can analyze commits since last tag
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 16
- name: Test Fetching Artifact
run: |
GITHUB_ACTION_REPOSITORY=Fresa/release-notes-generator \
GITHUB_ACTION_REF=vTEST \
INPUT_GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} \
node fetch_artifact.js
- name: Clean dist
run: |
rm -rf dist
- name: Install
run: npm ci
- name: Check
run: npm run prettier-check
- name: Build
run: npm run publish
- name: Assert Artifact Downloaded
run: ls -d $GITHUB_WORKSPACE/dist/index.js
- name: Determine Release Version
id: versioning
uses: Fresa/trunk-based-release-versioning@v0
- name: Determine Release Tag
id: release-tag
run: |
tag=v${{ steps.versioning.outputs.version }}
if ${{ steps.versioning.outputs.is-prerelease }}; then
tag="$tag-pre-$(echo ${{ steps.versioning.outputs.release-ref }} | cut -c1-8)"
fi
echo "tag=$tag" >> $GITHUB_OUTPUT
- name: Convert Commit Logs to JSON
id: convert-commit-logs
uses: mikefarah/yq@v4.30.6
with:
cmd: yq ea -o=json 'select(. != null) | [.]' "$(echo "${{ steps.versioning.outputs.commit-logs-path }}" | sed "s|^${{ github.workspace }}/||")" | tee commit_logs.json
- name: Generate Release Notes
id: release_notes
uses: ./
with:
version: ${{ steps.release-tag.outputs.tag }}
last_release_ref: ${{ steps.versioning.outputs.last-release-ref }}
release_ref: ${{ steps.versioning.outputs.release-ref }}
path_to_commits: ./commit_logs.json
- name: Write Release Notes to File
run: |
echo "${{ steps.release_notes.outputs.release_notes }}" > "release_notes.txt"
- name: Package
run: zip -rj artifacts.zip dist
- name: Create Tag
uses: actions/github-script@v7
with:
script: |
github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/${{ steps.release-tag.outputs.tag }}",
sha: "${{ steps.versioning.outputs.release-ref }}"
});
- name: Create Release
uses: softprops/action-gh-release@v2
with:
body_path: release_notes.txt
tag_name: ${{ steps.release-tag.outputs.tag }}
prerelease: ${{ steps.versioning.outputs.is-prerelease }}
files: artifacts.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update Latest Minor Tag
uses: EndBug/latest-tag@v1
if: steps.versioning.outputs.is-prerelease == 'false'
with:
ref: v${{ steps.versioning.outputs.major-version }}
description: ${{ steps.release-tag.outputs.tag }}
- name: Update Latest Patch Tag
uses: EndBug/latest-tag@v1
if: steps.versioning.outputs.is-prerelease == 'false'
with:
ref: v${{ steps.versioning.outputs.major-version }}.${{ steps.versioning.outputs.minor-version }}
description: ${{ steps.release-tag.outputs.tag }}