Skip to content

Commit 6d28362

Browse files
author
Ahmad Nassri
committed
chore(template): sync with ahmadnassri/template-action-composite
1 parent a56424a commit 6d28362

File tree

1 file changed

+57
-18
lines changed

1 file changed

+57
-18
lines changed

.github/workflows/push.yml

+57-18
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,33 @@
1-
on: push
1+
# ------------------------------------------------------- #
2+
# Note: this file originates in template-action-composite #
3+
# ------------------------------------------------------- #
4+
5+
on:
6+
- push
7+
- workflow_dispatch
28

39
name: push
410

511
jobs:
12+
metadata:
13+
runs-on: ubuntu-latest
14+
15+
outputs:
16+
repository: ${{ steps.metadata.outputs.repository }}
17+
18+
steps:
19+
- uses: actions/[email protected]
20+
21+
- uses: ahmadnassri/action-metadata@v1
22+
id: metadata
23+
624
commit-lint:
725
timeout-minutes: 5
826

927
runs-on: ubuntu-latest
1028

1129
steps:
12-
- uses: actions/checkout@v2.3.5
30+
- uses: actions/checkout@v3.0.2
1331

1432
- uses: ahmadnassri/action-commit-lint@v1
1533
with:
@@ -21,24 +39,28 @@ jobs:
2139
runs-on: ubuntu-latest
2240

2341
steps:
24-
- uses: actions/checkout@v2.3.5
42+
- uses: actions/checkout@v3.0.2
2543
with:
2644
fetch-depth: 0
2745

28-
- uses: github/super-linter@v3.17.1
46+
- uses: github/super-linter/slim@v4
2947
env:
3048
LOG_LEVEL: ERROR
31-
VALIDATE_ALL_CODEBASE: false
49+
VALIDATE_ALL_CODEBASE: 'false'
50+
IGNORE_GITIGNORED_FILES: 'true'
3251
FILTER_REGEX_EXCLUDE: '/github/workspace/README.md|test/fixtures/*'
3352
GITHUB_TOKEN: ${{ github.token }}
3453

3554
release:
55+
timeout-minutes: 5
56+
3657
needs:
58+
- metadata
3759
- commit-lint
3860
- super-linter
3961

40-
# only runs on main branch
41-
if: ${{ github.ref == 'refs/heads/master' }}
62+
# only runs on main branch for non template repos
63+
if: ${{ github.ref == 'refs/heads/master' && !fromJSON(needs.metadata.outputs.repository).is_template }}
4264

4365
runs-on: ubuntu-latest
4466

@@ -49,18 +71,18 @@ jobs:
4971
release-version-minor: ${{ steps.release.outputs.release-version-minor }}
5072

5173
steps:
52-
- uses: actions/checkout@v2.3.5
74+
- uses: actions/checkout@v3.0.2
5375
- id: release
54-
uses: ahmadnassri/action-semantic-release@v1
76+
uses: ahmadnassri/action-semantic-release@v2
5577
with:
5678
config: ${{ github.workspace }}/.semantic.json
5779
env:
58-
GITHUB_TOKEN: ${{ github.token }}
80+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5981

6082
alias:
6183
needs: release
6284

63-
if: needs.release.outputs.published == 'true'
85+
if: ${{ needs.release.outputs.published == 'true' }}
6486

6587
runs-on: ubuntu-latest
6688
strategy:
@@ -70,14 +92,31 @@ jobs:
7092
- version: v${{ needs.release.outputs.release-version-major }}.${{ needs.release.outputs.release-version-minor }}
7193

7294
steps:
73-
- uses: actions/github-script@v4.0.2
95+
- uses: actions/github-script@v6
7496
with:
7597
script: |
7698
const tag = 'tags/${{ matrix.alias.version }}'
77-
const repo = {
78-
owner: context.repo.owner,
79-
repo: context.repo.repo
80-
}
99+
await github.git.deleteRef({ ...context.repo, ref: tag }).catch(() => {})
100+
await github.git.createRef({ ...context.repo, ref: `refs/${tag}` , sha: process.env.GITHUB_SHA })
101+
102+
template-sync:
103+
timeout-minutes: 20
81104

82-
await github.git.deleteRef({ ...repo, ref: tag }).catch(() => {})
83-
await github.git.createRef({ ...repo, ref: `refs/${tag}` , sha: process.env.GITHUB_SHA })
105+
needs:
106+
- metadata
107+
- commit-lint
108+
- super-linter
109+
110+
# only runs on main branch and only for the template
111+
if: ${{ github.ref == 'refs/heads/master' && fromJSON(needs.metadata.outputs.repository).is_template }}
112+
113+
runs-on: ubuntu-latest
114+
115+
steps:
116+
- uses: ahmadnassri/[email protected]
117+
118+
- uses: actions/[email protected]
119+
120+
- uses: ahmadnassri/[email protected]
121+
with:
122+
github-token: ${{ secrets.GH_TOKEN }}

0 commit comments

Comments
 (0)