Skip to content

Commit d750901

Browse files
chore(ci): added an action to make GitHub & NPM releases when merging a release PR; (#5456)
1 parent 477c714 commit d750901

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

‎.github/workflows/publish.yml‎

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: "Publish on merge"
2+
on:
3+
pull_request:
4+
types:
5+
- closed
6+
branches:
7+
- main
8+
jobs:
9+
publish:
10+
if: github.event.pull_request.merged == true && github.event.pull_request.head.label == 'axios:release'
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: "Release PR info"
14+
run: echo "PR ${{ github.event.number }}"
15+
- uses: actions/checkout@v3
16+
- name: git config
17+
run: |
18+
git config user.name "${GITHUB_ACTOR}"
19+
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
20+
- uses: actions/setup-node@v3
21+
with:
22+
node-version: 16
23+
registry-url: https://registry.npmjs.org/
24+
- run: npm ci
25+
- name: get-npm-version
26+
id: package-version
27+
uses: martinbeentjes/npm-get-version-action@main
28+
- name: Extract release notes
29+
id: extract-release-notes
30+
uses: ffurrer2/extract-release-notes@v1
31+
- uses: 8BitJonny/gh-get-current-pr@2.2.0
32+
- name: Check versions
33+
run: node ./bin/check-build-version.js
34+
############# TAG RELEASE ##############
35+
- name: "Push tag v${{ steps.package-version.outputs.current-version }}"
36+
uses: rickstaa/action-create-tag@v1
37+
id: tag_version
38+
with:
39+
tag: "v${{ steps.package-version.outputs.current-version }}"
40+
############# GITHUB RELEASE ##############
41+
- name: "Create a GitHub release v${{ steps.package-version.outputs.current-version }}"
42+
uses: ncipollo/release-action@v1
43+
with:
44+
tag: "v${{ steps.package-version.outputs.current-version }}"
45+
name: "Release v${{ steps.package-version.outputs.current-version }}"
46+
body: |
47+
## Release notes:
48+
${{ steps.extract-release-notes.outputs.release_notes }}
49+
############# NPM RELEASE ##############
50+
- name: Publish the release to NPM
51+
run: echo "NPM publish command here" # temporary skipped
52+
env:
53+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

0 commit comments

Comments
 (0)