update: corrputed url @ tests#urls #43
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: 18 | |
- name: Install dependencies | |
run: npm ci | |
- name: Run lint | |
run: npm run lint | |
- name: Run tests | |
run: npm run test | |
publish_and_release: | |
needs: build | |
environment: "${{ github.ref_name == 'main' && 'Prod' || '' }}" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Generate token | |
if: ${{ github.ref_name == 'main'}} | |
id: generate_token | |
uses: tibdex/github-app-token@v1 | |
with: | |
app_id: ${{ vars.FUNDABOT_APP_ID }} | |
private_key: ${{ secrets.FUNDABOT_PRIVATE_KEY }} | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ github.ref_name == 'main' && steps.generate_token.outputs.token || secrets.GITHUB_TOKEN }} | |
- 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: Install dependencies | |
run: npm ci | |
- name: Create DOCUMENTATION.md | |
run: npm run docs | |
- name: Commit changes | |
env: | |
VERSION: ${{ steps.version.outputs.newTag }} | |
run: | | |
git config user.email "fundabot@fundwave.com" | |
git config user.name "fundabot" | |
git commit -a -m "CI: bumps @fundwave/fetch-queue to $VERSION" -m "[skip ci]" | |
- name: Publish package to gitlab | |
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 | |
npm publish --tag $BRANCH_TAG | |
- name: Publish package to npm | |
if: ${{ github.ref_name == 'main'}} | |
run: | | |
echo //registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN} > ~/.npmrc | |
echo registry=https://registry.npmjs.org/ >> ~/.npmrc | |
npm publish --tag $BRANCH_TAG --access public | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPMJS_TOKEN}} | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ env.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} | |
- name: Release | |
if: ${{ github.ref_name == 'main'}} | |
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} |