-
-
Notifications
You must be signed in to change notification settings - Fork 20
94 lines (85 loc) · 2.7 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Release NPM packages
env:
NODE_OPTIONS: --max-old-space-size=6144
NX_MAX_PARALLEL: 2
on:
workflow_dispatch:
inputs:
release_as:
type: 'choice'
description: 'The release type. It can be one of: major, minor, patch, premajor, preminor, prepatch, or prerelease. Defaults to "patch"'
required: true
default: 'patch'
options:
- major
- minor
- patch
- premajor
- preminor
- prepatch
- prerelease
jobs:
release:
runs-on: ubuntu-latest
# Only release from the main branch
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
with:
# Necessary for nx affected commands
fetch-depth: 0
- name: Setup
uses: ./.github/actions/setup
with:
git_bot_token: ${{ secrets.GIT_BOT_TOKEN }}
- name: Release @ngworker/lumberjack
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
# Generates the changelog commit and tags and pushes them to Github.
# Use two post actions to Create a release in Github and for Publishing the package to NPM
shell: bash
run: pnpm exec nx version ngworker-lumberjack --releaseAs=${{ github.event.inputs.release_as }}
# Needed if we want to automize multiple releases with the affected commands.
- name: Tag last-release
shell: bash
run: git tag -f last-release
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GH_TOKEN }}
branch: ${{ github.ref }}
force: true
tags: true
deploy-docs:
name: '[Merge] Deploy docs to GitHub Pages'
needs: release
runs-on: ubuntu-latest
permissions:
contents: read
actions: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Check out the source code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup
uses: ./.github/actions/setup
# Uses the cache generated in the distributed step
- name: Build docs
run: pnpm exec nx build docs-lumberjack-docs-app
- name: Set up GitHub Pages
uses: actions/configure-pages@v4
- name: Upload docs to GitHub Pages
uses: actions/upload-pages-artifact@v3
with:
path: dist/packages/docs/lumberjack-docs-app/
- name: Deploy docs to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4