Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
ci(GitHub): Update release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ardalanamini committed Apr 30, 2022
1 parent 1ae7f4a commit 67328b9
Showing 1 changed file with 67 additions and 40 deletions.
107 changes: 67 additions & 40 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,78 +1,105 @@
name: Create Release
name: Release

on:
push:
tags:
- 'v*'
- 'v[0-9]+.[0-9]+.[0-9]+*'

jobs:
build:
test:
uses: ./.github/workflows/test.yml

release:
name: Create Release

concurrency: github-release

environment:
name: release
url: https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}

runs-on: ubuntu-latest
env:
RELEASE: ${{ github.ref }}

needs:
- test

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14
- run: npm ci
- run: npm run lint
- run: npm run build
- run: npm run test:coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
env_vars: RELEASE
fail_ci_if_error: true
- uses: actions/checkout@v3

- name: Changelog
uses: ardalanamini/auto-changelog@v3
id: changelog
uses: ardalanamini/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: |
${{ steps.changelog.outputs.changelog }}
prerelease: ${{ steps.changelog.outputs.prerelease }}

publish-npm:
name: Publish to NPM
needs: build

concurrency: npm-release

environment:
name: npm
url: https://www.npmjs.com/package/@foxify/router

runs-on: ubuntu-latest

needs:
- release

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 14
node-version: 16
registry-url: https://registry.npmjs.org/

- run: npm ci
- run: npm run build

- run: npm run build:hybrid

- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

publish-gpr:
name: Publish to Github
needs: build
name: Publish to GitHub Packages

concurrency: gpr-release

environment:
name: gpr
url: https://github.com/${{ github.repository }}/packages

permissions:
contents: read
packages: write

runs-on: ubuntu-latest

needs:
- release

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 14
node-version: 16
registry-url: https://npm.pkg.github.com/
scope: '@foxifyjs'

- run: sed -i 's/@foxify\/router/@foxifyjs\/router/g' package.json package-lock.json

- run: npm ci
- run: npm run build

- run: npm run build:hybrid

- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
NODE_AUTH_TOKEN: ${{ github.token }}

0 comments on commit 67328b9

Please sign in to comment.