test update #64
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
persist-credentials: true | |
fetch-depth: 0 | |
token: ${{ secrets.AUTO_GITHUB_PAT_TOKEN }} | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18.15.0 | |
cache: 'npm' | |
registry-url: 'https://registry.npmjs.org' | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
- name: pr_labels | |
id: pr_labels | |
uses: joerick/[email protected] | |
- name: package_json | |
id: package_json | |
run: | | |
echo "version=$(jq -r .version < package.json)" >> $GITHUB_OUTPUT | |
- name: semver_versions | |
id: semver_versions | |
uses: "WyriHaximus/github-action-next-semvers@v1" | |
with: | |
version: ${{ steps.package_json.outputs.version }} | |
- name: patch_version | |
run: | | |
echo "NEW_VERSION=${{ steps.semver_versions.outputs.patch }}" >> $GITHUB_ENV | |
- name: minor_version | |
if: contains(steps.pr_labels.outputs.labels, 'minor') | |
run: | | |
echo "NEW_VERSION=${{ steps.semver_versions.outputs.minor }}" >> $GITHUB_ENV | |
- name: major_version | |
if: contains(steps.pr_labels.outputs.labels, 'major') | |
run: | | |
echo "NEW_VERSION=${{ steps.semver_versions.outputs.major }}" >> $GITHUB_ENV | |
- name: echo_version_info | |
run: | | |
echo "current version is ${{ steps.package_json.outputs.version }}" | |
echo "new version will be ${{ env.NEW_VERSION }}" | |
- name: update_composite_tags | |
run: | | |
npm run update-composite-tags ${{ env.NEW_VERSION }} | |
- name: update_package_json_version | |
run: | | |
echo "`jq '.version="${{ env.NEW_VERSION }}"' package.json`" > package.json | |
- name: commit_updates | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "Automation" | |
git add . | |
git commit -m "Updating composite tags and package.json version for v${{ env.NEW_VERSION }}" | |
- name: new_tags | |
env: | |
GITHUB_TOKEN: ${{ secrets.AUTO_GITHUB_PAT_TOKEN }} | |
run: | | |
git tag v${{ env.NEW_VERSION }} | |
git push --follow-tags --set-upstream origin main | |
# We reset the major tag so workflow consumers automatically receive these changes | |
- name: reset_major_tag | |
env: | |
GITHUB_TOKEN: ${{ secrets.AUTO_GITHUB_PAT_TOKEN }} | |
if: ${{ env.NEW_VERSION != steps.semver_versions.outputs.major }} | |
run: | | |
git tag -f v${{ steps.semver_versions.outputs.major }} | |
git push origin v${{ steps.semver_versions.outputs.major }} --force | |