-
-
Notifications
You must be signed in to change notification settings - Fork 529
fix: move to trusted publishing #1551
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,96 +1,67 @@ | ||
| name: CI | ||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| - v6 | ||
| - v7 | ||
| pull_request: | ||
| on: pull_request | ||
|
|
||
| jobs: | ||
| test-postgres: | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| node-version: [10, 16] | ||
| node-version: [10, 24] | ||
| sequelize-version: [5, latest] | ||
| name: Postgres (Node ${{ matrix.node-version }}, Sequelize ${{ matrix.sequelize-version }}) | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| DIALECT: postgres | ||
| SEQ_PORT: 54320 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-node@v4 | ||
| - uses: actions/checkout@v5 | ||
| - uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: ${{ matrix.node-version }} | ||
| - run: yarn install --frozen-lockfile --ignore-engines | ||
| - run: yarn add sequelize@${{ matrix.sequelize-version }} --ignore-engines | ||
| - run: if [ "${{ matrix.node-version }}" = "10" ]; then npm install -g npm@7; fi | ||
| - run: npm ci | ||
| - run: npm install sequelize@${{ matrix.sequelize-version }} | ||
| - run: docker compose up -d ${DIALECT} | ||
| - run: docker run --link ${DIALECT}:db --net cli_default jwilder/dockerize -wait tcp://${DIALECT}:${SEQ_PORT::-1} -timeout 2m | ||
| - run: yarn test | ||
| - run: npm test | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. while i dont mind, why are we moving to npm=
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because yarn doesn't offer the trusted publishing (yet). So we're locking in to the npm registry and its package manager |
||
| test-mysql: | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| node-version: [10, 16] | ||
| node-version: [10, 24] | ||
| sequelize-version: [5, latest] | ||
| name: MySQL (Node ${{ matrix.node-version }}, Sequelize ${{ matrix.sequelize-version }}) | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| DIALECT: mysql | ||
| SEQ_PORT: 33060 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-node@v4 | ||
| - uses: actions/checkout@v5 | ||
| - uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: ${{ matrix.node-version }} | ||
| - run: yarn install --frozen-lockfile --ignore-engines | ||
| - run: yarn add sequelize@${{ matrix.sequelize-version }} --ignore-engines | ||
| - run: if [ "${{ matrix.node-version }}" = "10" ]; then npm install -g npm@7; fi | ||
| - run: npm ci | ||
| - run: npm install sequelize@${{ matrix.sequelize-version }} | ||
| - run: docker compose up -d ${DIALECT} | ||
| - run: docker run --link ${DIALECT}:db --net cli_default jwilder/dockerize -wait tcp://${DIALECT}:${SEQ_PORT::-1} -timeout 2m | ||
| - run: yarn test | ||
| - run: npm test | ||
| test-sqlite: | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| node-version: [10, 16] | ||
| node-version: [10, 24] | ||
| sequelize-version: [5, latest] | ||
| name: SQLite (Node ${{ matrix.node-version }}, Sequelize ${{ matrix.sequelize-version }}) | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| DIALECT: sqlite | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-node@v4 | ||
| - uses: actions/checkout@v5 | ||
| - uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: ${{ matrix.node-version }} | ||
| - run: yarn install --frozen-lockfile --ignore-engines | ||
| - run: yarn add sequelize@${{ matrix.sequelize-version }} --ignore-engines | ||
| - run: yarn test | ||
| release: | ||
| name: Release | ||
| runs-on: ubuntu-latest | ||
| needs: | ||
| [ | ||
| test-sqlite, | ||
| test-postgres, | ||
| test-mysql | ||
| ] | ||
| if: github.event_name == 'push' && (github.ref == 'refs/heads/v6' || github.ref == 'refs/heads/v7') | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 18.x | ||
| - run: yarn install --frozen-lockfile | ||
| - run: npx semantic-release | ||
| - id: sequelize | ||
| uses: sdepold/github-action-get-latest-release@master | ||
| with: | ||
| repository: sequelize/cli | ||
| - run: | | ||
| 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 }}}}' | ||
| - run: if [ "${{ matrix.node-version }}" = "10" ]; then npm install -g npm@7; fi | ||
| - run: npm ci | ||
| - run: npm install sequelize@${{ matrix.sequelize-version }} | ||
| - run: npm test | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| name: Release | ||
| on: workflow_dispatch | ||
|
|
||
| permissions: | ||
| contents: read # for checkout | ||
|
|
||
| jobs: | ||
| release: | ||
| name: Release | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write # to be able to publish a GitHub release | ||
| issues: write # to be able to comment on released issues | ||
| pull-requests: write # to be able to comment on released pull requests | ||
| id-token: write # to enable use of OIDC for trusted publishing and npm provenance | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v5 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: 'lts/*' | ||
| - name: Install dependencies | ||
| run: npm clean-install | ||
| - name: Verify the integrity of provenance attestations and registry signatures for installed dependencies | ||
| run: npm audit signatures | ||
| - name: Release | ||
| id: release | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: npm run release | ||
| - name: Post release notes to OpenCollective | ||
| if: steps.release.outputs.new_release_published == 'true' | ||
| env: | ||
| OPENCOLLECTIVE_TOKEN: ${{ secrets.OPEN_COLLECTIVE_KEY }} | ||
| OPENCOLLECTIVE_SLUG: sequelize | ||
| RELEASE_VERSION: ${{ steps.release.outputs.new_release_version }} | ||
| RELEASE_NOTES: ${{ steps.release.outputs.new_release_notes }} | ||
| PACKAGE_NAME: sequelize-cli | ||
| run: | | ||
| curl -X POST "https://api.opencollective.com/graphql/v2" \ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this mean we dont need the dispatch job anymore that i created a few years ago?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup! |
||
| -H "Content-Type: application/json" \ | ||
| # TODO: use OAuth instead of Personal-Token so we can create the updates from the organization instead of a user | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what about this?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now when we post something to OpenCollective it's done under your name. With OAuth we should be able to do it under the name of the organization. This is a TODO for a later PR |
||
| -H "Personal-Token: $OPENCOLLECTIVE_TOKEN" \ | ||
| -d "{ | ||
| \"query\": \"mutation CreateUpdate(\$update: UpdateCreateInput!) { createUpdate(update: \$update) { id legacyId slug title html publishedAt } }\", | ||
| \"variables\": { | ||
| \"update\": { | ||
| \"account\": { | ||
| \"slug\": \"$OPENCOLLECTIVE_SLUG\" | ||
| }, | ||
| \"title\": \"Release of $PACKAGE_NAME $RELEASE_VERSION\", | ||
| \"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>\", | ||
| \"isPrivate\": false, | ||
| \"notificationAudience\": \"ALL\" | ||
| } | ||
| } | ||
| }" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,5 +27,5 @@ test/support/tmp/* | |
| !test/support/tmp/.gitkeep | ||
|
|
||
| # Extra files | ||
| package-lock.json | ||
| yarn.lock | ||
| npm-debug.log | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does this migrate from on push to on pull_request?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't run it 'on push' at the regular repo, so this makes it more consistent. Reasoning there was because we do everything with PRs that are up to date, we don't need to run it again after merging