Skip to content

Commit ea8bdd8

Browse files
Merge pull request #48 from oxidecomputer/hardening
Release / npm / repo hardening
2 parents 421283c + c544888 commit ea8bdd8

File tree

5 files changed

+2356
-2050
lines changed

5 files changed

+2356
-2050
lines changed

.github/workflows/check-release.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 60 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,73 @@
11
name: Release
22

3-
on: [push]
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
types: [opened, synchronize, reopened]
8+
9+
# Enabled permissions on GITHUB_TOKEN
10+
permissions:
11+
# To be able to push to the repo
12+
contents: write
13+
# To update the pr description with canary info
14+
pull-requests: write
15+
# For pr-check to create a status
16+
statuses: write
17+
# Needed to create PR statuses/checks
18+
checks: write
19+
# To post comments on PRs
20+
issues: write
21+
# For trusted publishing
22+
id-token: write
423

524
jobs:
6-
release:
25+
install:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v5
29+
- uses: actions/setup-node@v5
30+
with:
31+
node-version: 22.x
32+
- run: npm install
33+
- run: npm run tsc
34+
35+
validate-labels:
736
runs-on: ubuntu-latest
837
if:
938
"!contains(github.event.head_commit.message, 'ci skip') &&
1039
!contains(github.event.head_commit.message, 'skip ci')"
1140
steps:
12-
- uses: actions/checkout@v2
13-
14-
- name: Prepare repository
15-
run: git fetch --unshallow --tags
16-
17-
- name: Use Node.js 16.x
18-
uses: actions/setup-node@v1
41+
- uses: actions/checkout@v5
42+
- run: git fetch --unshallow --tags
43+
- uses: actions/setup-node@v5
1944
with:
20-
node-version: 16.x
21-
22-
- name: Install dependencies
23-
uses: bahmutov/npm-install@v1
45+
node-version: 22.x
46+
- run: npm install
47+
- name: Verify Release
48+
env:
49+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
run:
51+
npx auto pr-check
52+
--url=https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID
2453

54+
release:
55+
runs-on: ubuntu-latest
56+
environment: production
57+
if:
58+
"!contains(github.event.head_commit.message, 'ci skip') &&
59+
!contains(github.event.head_commit.message, 'skip ci')"
60+
steps:
61+
- uses: actions/checkout@v5
62+
- run: git fetch --unshallow --tags
63+
- uses: actions/setup-node@v5
64+
with:
65+
node-version: 22.x
66+
cache: 'npm'
67+
- run: npm install
68+
- run: npm install -g npm@latest
2569
- name: Create Release
70+
run: npm run build && npm run release
2671
env:
27-
GH_TOKEN: ${{ secrets.GH_TOKEN }}
28-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
29-
run: |
30-
npm run build && npm run release
72+
# auto expects GH_TOKEN in the environment
73+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)