Skip to content

Commit 35773a1

Browse files
authored
Merge pull request #876 from nextcloud-libraries/chore/update-workflows
ci: update workflows from organization
2 parents 3e83c63 + 0841c7e commit 35773a1

7 files changed

Lines changed: 74 additions & 166 deletions

File tree

.github/workflows/block-unconventional-commits.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This workflow is provided via the organization template repository
22
#
3-
# https://github.com/nextcloud/.github
3+
# https://github.com/nextcloud-libraries/.github
44
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
55
#
66
# SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
@@ -27,7 +27,9 @@ jobs:
2727

2828
steps:
2929
- name: Checkout
30-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
30+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
31+
with:
32+
persist-credentials: false
3133

3234
- uses: webiny/action-conventional-commits@8bc41ff4e7d423d56fa4905f6ff79209a78776c7 # v1.3.0
3335
with:

.github/workflows/dependabot-approve-merge.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This workflow is provided via the organization template repository
22
#
3-
# https://github.com/nextcloud/.github
3+
# https://github.com/nextcloud-libraries/.github
44
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
55
#
66
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
@@ -9,7 +9,7 @@
99
name: Dependabot
1010

1111
on:
12-
pull_request_target:
12+
pull_request_target: # zizmor: ignore[dangerous-triggers]
1313
branches:
1414
- main
1515
- master
@@ -24,7 +24,7 @@ concurrency:
2424

2525
jobs:
2626
auto-approve-merge:
27-
if: github.actor == 'dependabot[bot]' || github.actor == 'renovate[bot]'
27+
if: github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'renovate[bot]'
2828
runs-on: ubuntu-latest
2929
permissions:
3030
# for hmarr/auto-approve-action to approve PRs

.github/workflows/documentation.yml

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This workflow is provided via the organization template repository
22
#
3-
# https://github.com/nextcloud/.github
3+
# https://github.com/nextcloud-libraries/.github
44
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
55
#
66
# SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors
@@ -13,36 +13,24 @@ on:
1313
release:
1414
types: [published]
1515

16+
permissions:
17+
contents: write
18+
1619
jobs:
1720
build-and-deploy:
1821
runs-on: ubuntu-latest
1922

2023
name: Build and deploy
2124
steps:
22-
- name: Check actor permission level
23-
# Only allow admin to deploy on release
24-
if: github.event.release
25-
uses: skjnldsv/check-actor-permission@69e92a3c4711150929bca9fcf34448c5bf5526e7 # v2
26-
with:
27-
require: write
28-
2925
- name: Checkout
30-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
31-
32-
- name: Read package.json node and npm engines version
33-
uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2
34-
id: versions
26+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3527
with:
36-
fallbackNode: '^20'
37-
fallbackNpm: '^10'
28+
persist-credentials: false
3829

39-
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
40-
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
30+
- name: Set up node
31+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
4132
with:
42-
node-version: ${{ steps.versions.outputs.nodeVersion }}
43-
44-
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
45-
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
33+
node-version-file: 'package.json'
4634

4735
- name: Install dependencies & build
4836
env:

.github/workflows/lint-eslint.yml

Lines changed: 7 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This workflow is provided via the organization template repository
22
#
3-
# https://github.com/nextcloud/.github
3+
# https://github.com/nextcloud-libraries/.github
44
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
55
#
66
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
@@ -18,57 +18,21 @@ concurrency:
1818
cancel-in-progress: true
1919

2020
jobs:
21-
changes:
22-
runs-on: ubuntu-latest
23-
24-
outputs:
25-
src: ${{ steps.changes.outputs.src}}
26-
27-
steps:
28-
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
29-
id: changes
30-
continue-on-error: true
31-
with:
32-
filters: |
33-
src:
34-
- '.github/workflows/**'
35-
- 'src/**'
36-
- 'appinfo/info.xml'
37-
- 'package.json'
38-
- 'package-lock.json'
39-
- 'tsconfig.json'
40-
- '.eslintrc.*'
41-
- '.eslintignore'
42-
- '**.js'
43-
- '**.ts'
44-
- '**.vue'
45-
4621
lint:
4722
runs-on: ubuntu-latest
4823

49-
needs: changes
50-
if: needs.changes.outputs.src != 'false'
51-
52-
name: NPM lint
24+
name: eslint
5325

5426
steps:
5527
- name: Checkout
56-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
57-
58-
- name: Read package.json node and npm engines version
59-
uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2
60-
id: versions
28+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
6129
with:
62-
fallbackNode: '^20'
63-
fallbackNpm: '^10'
30+
persist-credentials: false
6431

65-
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
66-
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v3
32+
- name: Set up node
33+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
6734
with:
68-
node-version: ${{ steps.versions.outputs.nodeVersion }}
69-
70-
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
71-
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
35+
node-version-file: 'package.json'
7236

7337
- name: Install dependencies
7438
env:
@@ -78,18 +42,3 @@ jobs:
7842

7943
- name: Lint
8044
run: npm run lint
81-
82-
summary:
83-
permissions:
84-
contents: none
85-
runs-on: ubuntu-latest
86-
needs: [changes, lint]
87-
88-
if: always()
89-
90-
# This is the summary, we just avoid to rename it so that branch protection rules still match
91-
name: eslint
92-
93-
steps:
94-
- name: Summary status
95-
run: if ${{ needs.changes.outputs.src != 'false' && needs.lint.result != 'success' }}; then exit 1; fi

.github/workflows/node-test.yml

Lines changed: 8 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This workflow is provided via the organization template repository
22
#
3-
# https://github.com/nextcloud/.github
3+
# https://github.com/nextcloud-libraries/.github
44
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
55
#
66
# SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors
@@ -24,55 +24,20 @@ concurrency:
2424
cancel-in-progress: true
2525

2626
jobs:
27-
changes:
28-
runs-on: ubuntu-latest
29-
30-
outputs:
31-
src: ${{ steps.changes.outputs.src}}
32-
33-
steps:
34-
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
35-
id: changes
36-
continue-on-error: true
37-
with:
38-
filters: |
39-
src:
40-
- '.github/workflows/**'
41-
- '__tests__/**'
42-
- '__mocks__/**'
43-
- 'src/**'
44-
- 'appinfo/info.xml'
45-
- 'package.json'
46-
- 'package-lock.json'
47-
- 'tsconfig.json'
48-
- '**.js'
49-
- '**.ts'
50-
- '**.vue'
51-
5227
test:
5328
runs-on: ubuntu-latest
54-
55-
needs: changes
56-
if: needs.changes.outputs.src != 'false'
29+
name: node-tests
5730

5831
steps:
5932
- name: Checkout
60-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
61-
62-
- name: Read package.json node and npm engines version
63-
uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2
64-
id: versions
33+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
6534
with:
66-
fallbackNode: '^20'
67-
fallbackNpm: '^10'
35+
persist-credentials: false
6836

69-
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
70-
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
37+
- name: Set up node
38+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
7139
with:
72-
node-version: ${{ steps.versions.outputs.nodeVersion }}
73-
74-
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
75-
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
40+
node-version-file: 'package.json'
7641

7742
- name: Install dependencies & build
7843
env:
@@ -88,20 +53,6 @@ jobs:
8853
run: npm run test:coverage --if-present
8954

9055
- name: Collect coverage
91-
uses: codecov/codecov-action@54bcd8715eee62d40e33596ef5e8f0f48dbbccab # v4.1.0
56+
uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3
9257
with:
9358
files: ./coverage/lcov.info
94-
95-
summary:
96-
permissions:
97-
contents: none
98-
runs-on: ubuntu-latest
99-
needs: [changes, test]
100-
101-
if: always()
102-
103-
name: test-summary
104-
105-
steps:
106-
- name: Summary status
107-
run: if ${{ needs.changes.outputs.src != 'false' && needs.test.result != 'success' }}; then exit 1; fi

.github/workflows/npm-publish.yml

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This workflow is provided via the organization template repository
22
#
3-
# https://github.com/nextcloud/.github
3+
# https://github.com/nextcloud-libraries/.github
44
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
55
#
66
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
@@ -19,31 +19,29 @@ permissions:
1919
jobs:
2020
publish:
2121
runs-on: ubuntu-latest
22-
2322
name: Build and publish to npm
24-
steps:
25-
- name: Check actor permission level
26-
uses: skjnldsv/check-actor-permission@69e92a3c4711150929bca9fcf34448c5bf5526e7 # v3.0
27-
with:
28-
require: write
2923

24+
steps:
3025
- name: Checkout
31-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
32-
33-
- name: Read package.json node and npm engines version
34-
uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2
35-
id: versions
26+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3627
with:
37-
fallbackNode: '^20'
38-
fallbackNpm: '^10'
28+
persist-credentials: false
3929

40-
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
41-
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v3
30+
- name: Set up node
31+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
4232
with:
43-
node-version: ${{ steps.versions.outputs.nodeVersion }}
33+
node-version-file: 'package.json'
4434

45-
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
46-
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
35+
- name: Check tag matches package.json
36+
run: |
37+
VERSION=$(node -p -e "require('./package.json').version")
38+
GH_VERSION=$(echo "$GH_VERSION" | sed s,\^v,,)
39+
if [ "$VERSION" != "$GH_VERSION" ]; then
40+
echo "$VERSION does not match $GH_VERSION"
41+
exit 1;
42+
fi;
43+
env:
44+
GH_VERSION: ${{ github.event.release.tag_name }}
4745

4846
- name: Install dependencies & build
4947
env:
@@ -52,9 +50,24 @@ jobs:
5250
npm ci
5351
npm run build --if-present
5452
53+
- name: Fetch latest tag
54+
id: latest-tag
55+
run: |
56+
TAG=$(gh release list \
57+
--exclude-drafts \
58+
--exclude-pre-releases \
59+
--json isLatest,tagName \
60+
--jq 'map(select(.isLatest == true))[].tagName' \
61+
-R ${{ github.repository }})
62+
echo "Latest tag is $TAG"
63+
echo "LATEST_TAG=$TAG" >> $GITHUB_OUTPUT
64+
env:
65+
GH_TOKEN: ${{ github.token }}
66+
5567
- name: Publish
5668
run: |
5769
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
58-
npm publish
70+
npm publish --tag $RELEASE_GROUP
5971
env:
6072
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
73+
RELEASE_GROUP: ${{ (contains(github.ref, 'rc') || contains(github.ref, 'beta') || contains(github.ref, 'alpha')) && 'next' || ((steps.latest-tag.outputs.LATEST_TAG != github.event.release.tag_name) && 'stable' || 'latest') }}

.github/workflows/reuse.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This workflow is provided via the organization template repository
22
#
3-
# https://github.com/nextcloud/.github
3+
# https://github.com/nextcloud-libraries/.github
44
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
55

66
# SPDX-FileCopyrightText: 2022 Free Software Foundation Europe e.V. <https://fsfe.org>
@@ -11,12 +11,17 @@ name: REUSE Compliance Check
1111

1212
on: [pull_request]
1313

14+
permissions:
15+
contents: read
16+
1417
jobs:
1518
reuse-compliance-check:
1619
runs-on: ubuntu-latest
1720
steps:
18-
- name: Checkout
19-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
21+
- name: Checkout
22+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
23+
with:
24+
persist-credentials: false
2025

21-
- name: REUSE Compliance Check
22-
uses: fsfe/reuse-action@3ae3c6bdf1257ab19397fab11fd3312144692083 # v4.0.0
26+
- name: REUSE Compliance Check
27+
uses: fsfe/reuse-action@bb774aa972c2a89ff34781233d275075cbddf542 # v5.0.0

0 commit comments

Comments
 (0)