diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f3023f9..79965b8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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/auto-changelog@v1.1.0 - 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 }}