Skip to content

Commit

Permalink
Use semantic-release for releases
Browse files Browse the repository at this point in the history
  • Loading branch information
reakaleek committed Sep 6, 2023
1 parent f81aa09 commit 97c6069
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 27 deletions.
32 changes: 5 additions & 27 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ on:
default: false

permissions:
contents: write

env:
GH_TOKEN: ${{ github.token }}
contents: write # needed to push the tag and create the release

jobs:
release:
Expand All @@ -27,29 +24,10 @@ jobs:
vault-role-id: ${{ secrets.VAULT_ROLE_ID }}
vault-secret-id: ${{ secrets.VAULT_SECRET_ID }}
- run: npm ci # runs npm prepublish
- name: Bump the version
run: |
echo "VERSION=$(npm version)" >> $GITHUB_ENV
echo "NPM_PACKAGE=$(jq '.name' package.json) >> $GITHUB_ENV
- run: git push --tags
- uses: ./.github/actions/setup-totp
with:
vault-url: ${{ secrets.VAULT_ADDR }}
vault-role-id: ${{ secrets.VAULT_ROLE_ID }}
vault-secret-id: ${{ secrets.VAULT_SECRET_ID }}
- name: NPM Publish
run: npm publish --otp=${TOTP_CODE}
- name: Create 'latest' dist-tag
run: npm dist-tag --otp=${TOTP_CODE} add "${NPM_PACKAGE}@${VERSION}" latest
- name: Create 'stack_release' dist-tag
if: ${{ github.event.inputs.is-stack-release }}
run: npm dist-tag --otp=${TOTP_CODE} add "${NPM_PACKAGE}@${VERSION}" stack_release
- name: Create Draft Release Notes
run: >-
gh release create "${VERSION}"
--title="${VERSION}"
--generate-notes
--draft
- run: npx semantic-release --dry-run="${DRY_RUN}"
env:
DRY_RUN: ${{ github.event.inputs.dry-run }}
GITHUB_TOKEN: ${{ github.token }}
- if: always()
uses: elastic/apm-pipeline-library/.github/actions/notify-build-status@current
with:
Expand Down
3 changes: 3 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"branches": ["main"]
}

0 comments on commit 97c6069

Please sign in to comment.