Skip to content

Commit ffe3f78

Browse files
author
Ahmad Nassri
committed
fix(action): use docker image in action.yaml for simpler user-experience
1 parent 8713970 commit ffe3f78

File tree

3 files changed

+46
-5
lines changed

3 files changed

+46
-5
lines changed

.github/workflows/release.yml

+25-3
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ jobs:
1414
- uses: actions/[email protected]
1515

1616
# run checks
17-
- run: npm audit --audit-level=critical
18-
- run: npx updated
17+
- run: npm audit --audit-level=moderate
1918

2019
release:
2120
needs: dependencies
@@ -26,16 +25,39 @@ jobs:
2625
published: ${{ steps.release.outputs.published }}
2726
release-version: ${{ steps.release.outputs.release-version }}
2827
release-version-major: ${{ steps.release.outputs.release-version-major }}
28+
release-version-minor: ${{ steps.release.outputs.release-version-minor }}
2929

3030
steps:
3131
- uses: actions/checkout@v2
32-
3332
- id: release
3433
name: dogfood
3534
uses: ./
3635
env:
3736
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3837

38+
alias:
39+
needs: release
40+
if: needs.release.outputs.published == 'true'
41+
runs-on: ubuntu-latest
42+
strategy:
43+
matrix:
44+
alias:
45+
- version: v${{ needs.release.outputs.release-version-major }}
46+
- version: v${{ needs.release.outputs.release-version-major }}.${{ needs.release.outputs.release-version-minor }}
47+
48+
steps:
49+
- uses: actions/github-script@v2
50+
with:
51+
script: |
52+
const tag = 'tags/${{ matrix.alias.version }}'
53+
const repo = {
54+
owner: context.repo.owner,
55+
repo: context.repo.repo
56+
}
57+
58+
await github.git.deleteRef({ ...repo, ref: tag }).catch(() => {})
59+
await github.git.createRef({ ...repo, ref: `refs/${tag}` , sha: process.env.GITHUB_SHA })
60+
3961
publish:
4062
needs: release
4163
if: needs.release.outputs.published == 'true'

README.md

+18-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
# GitHub Action: Semantic Release
22

3+
[![license][license-img]][license-url]
4+
[![version][release-img]][release-url]
5+
[![super linter][super-linter-img]][super-linter-url]
6+
[![release][release-img]][release-url]
7+
8+
[license-url]: LICENSE
9+
[license-img]: https://badgen.net/github/license/ahmadnassri/action-semantic-release
10+
11+
[release-url]: https://github.com/ahmadnassri/action-semantic-release/releases
12+
[release-img]: https://badgen.net//github/release/ahmadnassri/action-semantic-release
13+
14+
[super-linter-url]: https://github.com/ahmadnassri/action-semantic-release/actions?query=workflow%3Asuper-linter
15+
[super-linter-img]: https://github.com/ahmadnassri/action-semantic-release/workflows/super-linter/badge.svg
16+
17+
[release-url]: https://github.com/ahmadnassri/action-semantic-release/actions?query=workflow%3Arelease
18+
[release-img]: https://github.com/ahmadnassri/action-semantic-release/workflows/release/badge.svg
19+
320
[`semantic-release`](https://semantic-release.gitbook.io/) as a GitHub Action, with **all** presets included.
421

522
- works with environment variables as documented in [`semantic-release` docs](https://semantic-release.gitbook.io/semantic-release/usage/ci-configuration#authentication)
@@ -21,7 +38,7 @@ jobs:
2138
uses: actions/checkout@v2
2239

2340
- name: semantic-release
24-
uses: docker://ahmadnassri/action-semantic-release:v1
41+
uses: ahmadnassri/action-semantic-release@v1
2542
env:
2643
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
2744
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

action.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ branding:
77

88
runs:
99
using: docker
10-
image: Dockerfile
10+
image: docker://ahmadnassri/action-semantic-release:v1
11+
env:
12+
GITHUB_TOKEN: ${{ github.token }}
1113

1214
outputs:
1315
published:

0 commit comments

Comments
 (0)