feat: maintain reference to refresh-promise to avoid repetitive calls #15
Workflow file for this run
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 and Publish | |
on: [push] | |
env: | |
BRANCH_TAG: "${{ github.ref_name == 'main' && 'latest' || github.ref_name }}" | |
BRANCH: ${{ github.ref_name }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Install dependencies | |
run: npm ci | |
- name: Run lint | |
run: npm run lint | |
- name: Run tests | |
run: npm run test | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Version bump | |
id: version | |
uses: phips28/gh-action-bump-version@v9.1.0 | |
with: | |
major-wording: ${{ env.BRANCH == 'main' && '[bump major]' || '[bump major --force]' }} | |
minor-wording: ${{ env.BRANCH == 'main' && '[bump minor]' || '[bump minor --force]' }} | |
patch-wording: ${{ null }} | |
rc-wording: ${{ null }} | |
default: "${{ env.BRANCH == 'main' && 'patch' || 'prerelease' }}" | |
preid: "${{ env.BRANCH }}" | |
skip-tag: "true" | |
skip-push: "true" | |
skip-commit: "true" | |
bump-policy: "ignore" | |
- name: Release | |
env: | |
VERSION: ${{ steps.version.outputs.newTag }} | |
run: | | |
if [ "${BRANCH}" != "main" ]; then PRERELEASE="-p"; fi | |
echo "Releasing version ${VERSION} on branch ${BRANCH}" | |
gh release create ${VERSION} --target ${BRANCH} --generate-notes ${PRERELEASE} | |
- name: Commit changes | |
env: | |
VERSION: ${{ steps.version.outputs.newTag }} | |
run: | | |
git config user.name github-actions[bot] | |
git config user.email github-actions[bot]@users.noreply.github.com | |
git commit -a -m "CI: bumps fundwave/oidc-client to $VERSION" | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ env.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} | |
publish-npmjs: | |
needs: release | |
environment: prod | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- run: git pull origin ${{ github.ref }} | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
registry-url: https://registry.npmjs.org | |
- name: Install dependencies | |
run: npm ci | |
- name: Publish package | |
run: npm publish --tag $BRANCH_TAG --access public | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPMJS_TOKEN}} | |
publish-gitlab: | |
needs: release | |
environment: prod | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- run: git pull origin ${{ github.ref }} | |
- name: Setup .npmrc file for publish | |
env: | |
GITLAB_TOKEN: ${{secrets.GITLAB_TOKEN}} | |
run: | | |
echo @fundwave:registry=https://gitlab.com/api/v4/projects/24877554/packages/npm/ >> ~/.npmrc | |
echo //gitlab.com/api/v4/projects/24877554/packages/npm/:_authToken=$GITLAB_TOKEN >> ~/.npmrc | |
- name: Install dependencies | |
run: npm ci | |
- name: Publish package | |
run: npm publish --tag $BRANCH_TAG |