Skip to content

Commit 5fb289c

Browse files
authored
Merge pull request #921 from nextcloud/feat/add-release-relay-and-npm-audit-fix-workflows
feat: add release relay and npm audit fix workflows
2 parents f3ebac3 + 916ee07 commit 5fb289c

2 files changed

Lines changed: 123 additions & 0 deletions

File tree

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
4+
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
#
6+
# SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors
7+
# SPDX-License-Identifier: MIT
8+
9+
name: Npm audit fix and compile
10+
11+
on:
12+
workflow_dispatch:
13+
schedule:
14+
# At 2:30 on Sundays
15+
- cron: '30 2 * * 0'
16+
17+
permissions:
18+
contents: read
19+
20+
jobs:
21+
build:
22+
runs-on: ubuntu-latest
23+
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
branches:
28+
- ${{ github.event.repository.default_branch }}
29+
- 'stable34'
30+
- 'stable33'
31+
- 'stable32'
32+
33+
name: npm-audit-fix-${{ matrix.branches }}
34+
35+
steps:
36+
- name: Checkout
37+
id: checkout
38+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
39+
with:
40+
persist-credentials: false
41+
ref: ${{ matrix.branches }}
42+
continue-on-error: true
43+
44+
- name: Read package.json node and npm engines version
45+
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
46+
id: versions
47+
with:
48+
fallbackNode: '^24'
49+
fallbackNpm: '^11.3'
50+
51+
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
52+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
53+
with:
54+
node-version: ${{ steps.versions.outputs.nodeVersion }}
55+
56+
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
57+
run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}'
58+
59+
- name: Fix npm audit
60+
id: npm-audit
61+
uses: nextcloud-libraries/npm-audit-action@1b1728b2b4a7a78d69de65608efcf4db0e3e42d0 # v0.2.0
62+
63+
- name: Run npm ci and npm run build
64+
if: steps.checkout.outcome == 'success'
65+
env:
66+
CYPRESS_INSTALL_BINARY: 0
67+
run: |
68+
npm ci
69+
npm run build --if-present
70+
71+
- name: Create Pull Request
72+
if: steps.checkout.outcome == 'success'
73+
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
74+
with:
75+
token: ${{ secrets.COMMAND_BOT_PAT }}
76+
commit-message: 'fix(deps): Fix npm audit'
77+
committer: GitHub <noreply@github.com>
78+
author: nextcloud-command <nextcloud-command@users.noreply.github.com>
79+
signoff: true
80+
branch: automated/noid/${{ matrix.branches }}-fix-npm-audit
81+
title: '[${{ matrix.branches }}] Fix npm audit'
82+
body: ${{ steps.npm-audit.outputs.markdown }}
83+
labels: |
84+
dependencies
85+
3. to review
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
4+
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
#
6+
# SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
7+
# SPDX-License-Identifier: MIT
8+
9+
name: Notify release-relay on release
10+
11+
on:
12+
release:
13+
types: [published]
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
notify:
20+
name: Dispatch release to release-relay
21+
runs-on: ubuntu-latest
22+
23+
# Only allowed to run on nextcloud-releases repositories
24+
if: ${{ github.repository_owner == 'nextcloud-releases' }}
25+
26+
steps:
27+
- name: Check actor permission
28+
uses: skjnldsv/check-actor-permission@69e92a3c4711150929bca9fcf34448c5bf5526e7 # v3.0
29+
with:
30+
require: write
31+
32+
- name: Dispatch to release-relay
33+
uses: peter-evans/repository-dispatch@28959ce8df70de7be546dd1250a005dd32156697 # v4.0.1
34+
with:
35+
token: ${{ secrets.DISPATCH_PAT }}
36+
repository: nextcloud-gmbh/release-relay
37+
event-type: app-tagged
38+
client-payload: '{"app": "${{ github.repository }}", "tag": "${{ github.event.release.tag_name }}"}'

0 commit comments

Comments
 (0)