fix(ci): final fix, npm version patch already commits #61
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: Tag and Release | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: read | |
jobs: | |
tag-and-release: | |
name: Tag and Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
id: checkout | |
uses: actions/checkout@v4 | |
with: | |
token: ${{secrets.CONTENTS_AND_WORKFLOWS_TOKEN}} | |
- name: Setup Node.js | |
id: setup-node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: .node-version | |
cache: npm | |
- name: Install Dependencies | |
id: npm-ci | |
run: npm ci | |
- name: Check Format | |
id: npm-format-check | |
run: npm run format:check | |
- name: Lint | |
id: npm-lint | |
run: npm run lint | |
- name: Test | |
id: npm-ci-test | |
run: npm run ci-test | |
- name: Coverage | |
id: npm-coverage | |
run: npm run coverage | |
- name: Commit and push updated version | |
id: update_tag | |
run: | | |
echo "$(git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:'## %H%n%an <%ae>%n%ad%n%s%n%b%n')" > release_body.md | |
git config --global user.name "Awell CI" | |
git config --global user.email "ci@awellhealth.com" | |
npm version patch | |
npm run bundle | |
new_version=$(cat package.json | jq -r '.version') | |
git push | |
git tag -a $new_version -m "ci: update tag with new version $new_version" && git push --tags | |
echo "new_version=$new_version" >> "$GITHUB_OUTPUT" | |
- name: Create release | |
uses: actions/create-release@latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.CONTENTS_AND_WORKFLOWS_TOKEN }} | |
TAG_NAME: ${{ steps.update_tag.outputs.new_version }} | |
with: | |
tag_name: ${{ env.TAG_NAME }} | |
release_name: ${{ env.TAG_NAME }} | |
body_path: release_body.md | |
draft: false | |
prerelease: false | |
# test-action: | |
# name: GitHub Actions Test | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout | |
# id: checkout | |
# uses: actions/checkout@v4 | |
# TODO: Add support for bypassing API for local testing | |
# - name: Test Local Action | |
# id: test-action | |
# uses: ./ | |
# with: | |
# api_key: test | |
# careflow_id: | |
# - name: Print Output | |
# id: output | |
# run: echo "${{ steps.test-action.outputs.time }}" |