Skip to content

(Tag): Prepare

(Tag): Prepare #7

Workflow file for this run

name: "(Tag): Prepare"
permissions:
contents: write
pull-requests: write
actions: read
on:
workflow_dispatch:
inputs:
version:
description: 'Version to create the tag for (e.g. 3.6.9) or `next`'
required: true
type: string
default: next
jobs:
get-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout branch for release
uses: actions/checkout@v4
- name: Get tag version
id: version
run: |
if [ "${{ github.event.inputs.version }}" = "next" ]; then
CURR=$(jq -r .version package.json)
MAJOR=$(echo $CURR | cut -d. -f1)
MINOR=$(echo $CURR | cut -d. -f2)
PATCH=$(echo $CURR | cut -d. -f3)
NEW_PATCH=$((PATCH+1))
NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH"
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
else
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
fi
changelog:
uses: codesnippetspro/.github-private/.github/workflows/changelog.yml@main

Check failure on line 42 in .github/workflows/prepare-tag.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/prepare-tag.yml

Invalid workflow file

error parsing called workflow ".github/workflows/prepare-tag.yml" -> "codesnippetspro/.github-private/.github/workflows/changelog.yml@main" : workflow was not found. See https://docs.github.com/actions/learn-github-actions/reusing-workflows#access-to-reusable-workflows for more information.
needs: get-version
secrets: inherit
with:
repo: ${{ github.repository }}
branch: ${{ github.ref_name }}
tag: ${{ needs.get-version.outputs.version }}
git-push:
runs-on: ubuntu-latest
needs: [get-version, changelog]
steps:
- name: Checkout branch for release
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: .node-version
- name: Install Dependencies & Configure Git
run: |
npm install
git config user.name "code-snippets-bot"
git config user.email "[email protected]"
- name: Create and switch to tag branch
run: |
git checkout -b "tag/v${{ needs.get-version.outputs.version }}"
- name: Commit changelog update
run: |
echo "${{ needs.changelog.outputs.patch }}" | git apply -
git ls-files --others --modified --exclude-standard | xargs git add
git add -u
git commit -m "chore(changelog): v${{ needs.get-version.outputs.version }}"
- name: Commit version update
run: |
npm --no-git-tag-version version ${{ needs.get-version.outputs.version }}
git ls-files --others --modified --exclude-standard | xargs git add
git add -u
git commit -m "chore(tag): v${{ needs.get-version.outputs.version }}"
- name: "Push to branch `tag/v${{ needs.get-version.outputs.version }}`"
run: |
git push --set-upstream origin "tag/v${{ needs.get-version.outputs.version }}"
- name: "Open pull request: chore(release): `v${{ needs.get-version.outputs.version }}`"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create --title 'chore(release): `v${{ needs.get-version.outputs.version }}`' --body 'Release `v${{ needs.get-version.outputs.version }}`' --base main --head "tag/v${{ needs.get-version.outputs.version }}"