Skip to content

Commit d59e20d

Browse files
authored
fix: move to trusted publishing (#1551)
* fix: move to trusted publishing Also moves the CI workflow to npm and updates CI in general. Moves the release workflow to a separate one that is called when we want to do a release. This manual action is in line with how we do `@sequelize/*` releases, I have removed the tests from it since tests need to pass before we merge. * build(deps): update lockfile * ci: use npm 7 on Node 10
1 parent 031ee87 commit d59e20d

File tree

7 files changed

+12664
-6684
lines changed

7 files changed

+12664
-6684
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,67 @@
11
name: CI
2-
on:
3-
push:
4-
branches:
5-
- main
6-
- v6
7-
- v7
8-
pull_request:
2+
on: pull_request
93

104
jobs:
115
test-postgres:
126
strategy:
137
fail-fast: false
148
matrix:
15-
node-version: [10, 16]
9+
node-version: [10, 24]
1610
sequelize-version: [5, latest]
1711
name: Postgres (Node ${{ matrix.node-version }}, Sequelize ${{ matrix.sequelize-version }})
1812
runs-on: ubuntu-latest
1913
env:
2014
DIALECT: postgres
2115
SEQ_PORT: 54320
2216
steps:
23-
- uses: actions/checkout@v4
24-
- uses: actions/setup-node@v4
17+
- uses: actions/checkout@v5
18+
- uses: actions/setup-node@v6
2519
with:
2620
node-version: ${{ matrix.node-version }}
27-
- run: yarn install --frozen-lockfile --ignore-engines
28-
- run: yarn add sequelize@${{ matrix.sequelize-version }} --ignore-engines
21+
- run: if [ "${{ matrix.node-version }}" = "10" ]; then npm install -g npm@7; fi
22+
- run: npm ci
23+
- run: npm install sequelize@${{ matrix.sequelize-version }}
2924
- run: docker compose up -d ${DIALECT}
3025
- run: docker run --link ${DIALECT}:db --net cli_default jwilder/dockerize -wait tcp://${DIALECT}:${SEQ_PORT::-1} -timeout 2m
31-
- run: yarn test
26+
- run: npm test
3227
test-mysql:
3328
strategy:
3429
fail-fast: false
3530
matrix:
36-
node-version: [10, 16]
31+
node-version: [10, 24]
3732
sequelize-version: [5, latest]
3833
name: MySQL (Node ${{ matrix.node-version }}, Sequelize ${{ matrix.sequelize-version }})
3934
runs-on: ubuntu-latest
4035
env:
4136
DIALECT: mysql
4237
SEQ_PORT: 33060
4338
steps:
44-
- uses: actions/checkout@v4
45-
- uses: actions/setup-node@v4
39+
- uses: actions/checkout@v5
40+
- uses: actions/setup-node@v6
4641
with:
4742
node-version: ${{ matrix.node-version }}
48-
- run: yarn install --frozen-lockfile --ignore-engines
49-
- run: yarn add sequelize@${{ matrix.sequelize-version }} --ignore-engines
43+
- run: if [ "${{ matrix.node-version }}" = "10" ]; then npm install -g npm@7; fi
44+
- run: npm ci
45+
- run: npm install sequelize@${{ matrix.sequelize-version }}
5046
- run: docker compose up -d ${DIALECT}
5147
- run: docker run --link ${DIALECT}:db --net cli_default jwilder/dockerize -wait tcp://${DIALECT}:${SEQ_PORT::-1} -timeout 2m
52-
- run: yarn test
48+
- run: npm test
5349
test-sqlite:
5450
strategy:
5551
fail-fast: false
5652
matrix:
57-
node-version: [10, 16]
53+
node-version: [10, 24]
5854
sequelize-version: [5, latest]
5955
name: SQLite (Node ${{ matrix.node-version }}, Sequelize ${{ matrix.sequelize-version }})
6056
runs-on: ubuntu-latest
6157
env:
6258
DIALECT: sqlite
6359
steps:
64-
- uses: actions/checkout@v4
65-
- uses: actions/setup-node@v4
60+
- uses: actions/checkout@v5
61+
- uses: actions/setup-node@v6
6662
with:
6763
node-version: ${{ matrix.node-version }}
68-
- run: yarn install --frozen-lockfile --ignore-engines
69-
- run: yarn add sequelize@${{ matrix.sequelize-version }} --ignore-engines
70-
- run: yarn test
71-
release:
72-
name: Release
73-
runs-on: ubuntu-latest
74-
needs:
75-
[
76-
test-sqlite,
77-
test-postgres,
78-
test-mysql
79-
]
80-
if: github.event_name == 'push' && (github.ref == 'refs/heads/v6' || github.ref == 'refs/heads/v7')
81-
env:
82-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
83-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
84-
steps:
85-
- uses: actions/checkout@v4
86-
- uses: actions/setup-node@v4
87-
with:
88-
node-version: 18.x
89-
- run: yarn install --frozen-lockfile
90-
- run: npx semantic-release
91-
- id: sequelize
92-
uses: sdepold/github-action-get-latest-release@master
93-
with:
94-
repository: sequelize/cli
95-
- run: |
96-
curl -XPOST -u "sdepold:${{ secrets.GH_TOKEN }}" -H "Accept: application/vnd.github.v3+json" -H "Content-Type: application/json" https://api.github.com/repos/sequelize/cli/dispatches --data '{"event_type":"Release notifier","client_payload":{"release-id": ${{ steps.sequelize.outputs.id }}}}'
64+
- run: if [ "${{ matrix.node-version }}" = "10" ]; then npm install -g npm@7; fi
65+
- run: npm ci
66+
- run: npm install sequelize@${{ matrix.sequelize-version }}
67+
- run: npm test

.github/workflows/notify.yml

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

.github/workflows/release.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Release
2+
on: workflow_dispatch
3+
4+
permissions:
5+
contents: read # for checkout
6+
7+
jobs:
8+
release:
9+
name: Release
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write # to be able to publish a GitHub release
13+
issues: write # to be able to comment on released issues
14+
pull-requests: write # to be able to comment on released pull requests
15+
id-token: write # to enable use of OIDC for trusted publishing and npm provenance
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v5
19+
with:
20+
fetch-depth: 0
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v6
23+
with:
24+
node-version: 'lts/*'
25+
- name: Install dependencies
26+
run: npm clean-install
27+
- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
28+
run: npm audit signatures
29+
- name: Release
30+
id: release
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
run: npm run release
34+
- name: Post release notes to OpenCollective
35+
if: steps.release.outputs.new_release_published == 'true'
36+
env:
37+
OPENCOLLECTIVE_TOKEN: ${{ secrets.OPEN_COLLECTIVE_KEY }}
38+
OPENCOLLECTIVE_SLUG: sequelize
39+
RELEASE_VERSION: ${{ steps.release.outputs.new_release_version }}
40+
RELEASE_NOTES: ${{ steps.release.outputs.new_release_notes }}
41+
PACKAGE_NAME: sequelize-cli
42+
run: |
43+
curl -X POST "https://api.opencollective.com/graphql/v2" \
44+
-H "Content-Type: application/json" \
45+
# TODO: use OAuth instead of Personal-Token so we can create the updates from the organization instead of a user
46+
-H "Personal-Token: $OPENCOLLECTIVE_TOKEN" \
47+
-d "{
48+
\"query\": \"mutation CreateUpdate(\$update: UpdateCreateInput!) { createUpdate(update: \$update) { id legacyId slug title html publishedAt } }\",
49+
\"variables\": {
50+
\"update\": {
51+
\"account\": {
52+
\"slug\": \"$OPENCOLLECTIVE_SLUG\"
53+
},
54+
\"title\": \"Release of $PACKAGE_NAME $RELEASE_VERSION\",
55+
\"html\": \"<h2>Release of $PACKAGE_NAME $RELEASE_VERSION</h2><p>We've just released version $RELEASE_VERSION of $PACKAGE_NAME!</p><h3>Changes:</h3><pre>$RELEASE_NOTES</pre><p>Install it with: <code>npm install $PACKAGE_NAME@$RELEASE_VERSION</code></p>\",
56+
\"isPrivate\": false,
57+
\"notificationAudience\": \"ALL\"
58+
}
59+
}
60+
}"

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ test/support/tmp/*
2727
!test/support/tmp/.gitkeep
2828

2929
# Extra files
30-
package-lock.json
30+
yarn.lock
3131
npm-debug.log

0 commit comments

Comments
 (0)