Skip to content

Release/workflow test #2

Release/workflow test

Release/workflow test #2

Workflow file for this run

name: Draft release
on:
pull_request:
branches:
- test_next
jobs:
build_dist:
name: Build dist files
if: startsWith(github.head_ref, 'release/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: '18'
- run: npm ci
- run: |
rm -rf dist/
npm run build:content
git add package* dist/
version_tag_release_draft:
name: Version and tag release draft
if: startsWith(github.head_ref , 'release/')
runs-on: ubuntu-latest
# https://docs.github.com/en/actions/using-jobs/defining-outputs-for-jobs
outputs:
new_tag: ${{ steps.bump_version.outputs }}
steps:
- name: Parse changelog
id: get_changelog
run: echo "changelog=$(npm run changelog)" >> "$GITHUB_OUTPUT"
# https://stackoverflow.com/questions/59191913/how-do-i-get-the-output-of-a-specific-step-in-github-actions
- name: Determine version bump
id: determine_bump
run: |
echo "isMajor=${{ contains(steps.get_changelog.outputs.changelog, '!:') }}" >> "$GITHUB_OUTPUT"
echo "isMinor=${{ contains(steps.get_changelog.outputs.changelog, 'feat') && !steps.determine_bump.isMajor }}" >> "$GITHUB_OUTPUT"
- name: Increment version
id: bump_version
run: |
npm version ${{ (steps.determine_bump.outputs.isMajor && 'major') || (steps.determine_bump.outputs.isMinor && 'minor') || 'patch' }} -m "chore(release): Bumps version to v%s and updates dist files"
create_release_draft:
name: Create release draft
runs-on: ubuntu-latest
needs: version_tag_release_draft
steps:
- name: Build changelog
id: build_changelog
uses: mikepenz/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
owner: Laboratoria
# fromTag: v7.1.0
# toTag: v7.6.0
- name: Make release draft
id: release_draft
run: |
echo ${{ job.version_tag_release_draft.outputs.new_tag }}
# echo ${{ steps.build_changelog.outputs.changelog }}
# run: |
# gh release create ${{ jobs.version_tag_release_draft.outputs.new_tag }} \
# --repo="$GITHUB_REPOSITORY" \
# --title="${GITHUB_REPOSITORY#*/} ${{ jobs.version_tag_release_draft.outputs.new_tag }}" \
# --notes ${{steps.build_changelog.outputs.changelog}} \
# --draft