-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
430361c
commit 1939bcc
Showing
7 changed files
with
146 additions
and
128 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: Publish npm Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- v[0-9]+.[0-9]+.[0-9]+ | ||
|
||
jobs: | ||
test: | ||
uses: ./.github/workflows/test.yml | ||
with: | ||
electron-version: ${{ github.ref_name }} | ||
release: | ||
runs-on: ubuntu-latest | ||
needs: test | ||
environment: npm | ||
permissions: | ||
contents: write # for creating new release | ||
id-token: write # for CFA | ||
steps: | ||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
- name: "Use Node.js ${{ matrix.node-version }}" | ||
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 | ||
with: | ||
node-version: "20.16.0" | ||
- name: Update Version | ||
run: node script/update-version.js ${{ github.ref_name }} | ||
- name: Confirm Version Updated | ||
run: node -e "if (require('./package.json').version === '0.0.0-development') process.exit(1)" | ||
- name: Install Dependencies | ||
run: npm ci | ||
- name: Obtain OIDC token | ||
id: oidc | ||
run: | | ||
token=$(curl --fail -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \ | ||
"$ACTIONS_ID_TOKEN_REQUEST_URL&audience=continuousauth.dev" | jq -r '.value') | ||
echo "::add-mask::${token}" | ||
echo "token=${token}" >> $GITHUB_OUTPUT | ||
- name: Obtain GitHub credentials | ||
id: github_creds | ||
run: | | ||
token=$(curl --fail "https://continuousauth.dev/api/request/${{ secrets.CFA_PROJECT_ID }}/github/credentials" \ | ||
-X POST \ | ||
-H "Content-Type: application/json" \ | ||
-H "Authorization: bearer ${{ secrets.CFA_SECRET }}" \ | ||
--data "{\"token\":\"${{ steps.oidc.outputs.token }}\"}" | jq -r '.GITHUB_TOKEN') | ||
echo "::add-mask::${token}" | ||
echo "token=${token}" >> $GITHUB_OUTPUT | ||
- name: Set NPM Credentials | ||
run: echo //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }} > ~/.npmrc | ||
- name: Check NPM Credentials | ||
run: npm whoami | ||
- name: CFA Publish | ||
env: | ||
CFA_PROJECT_ID: ${{ secrets.CFA_PROJECT_ID }} | ||
CFA_SECRET: ${{ secrets.CFA_SECRET }} | ||
GITHUB_OIDC_TOKEN: ${{ steps.oidc.outputs.token }} | ||
run: node script/publish.js | ||
- name: Create Release | ||
env: | ||
GITHUB_TOKEN: ${{ steps.github_creds.outputs.token }} | ||
run: gh release create ${{ github.ref_name }} -t ${{ github.ref_name }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Test | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
electron-version: | ||
required: true | ||
type: string | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 19 * * 1-5' | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
test: | ||
defaults: | ||
run: | ||
shell: bash | ||
strategy: | ||
matrix: | ||
node-version: | ||
- '20.16.0' | ||
- '18.20.4' | ||
- '16.20.2' | ||
- '14.21.3' | ||
os: | ||
- macos-latest | ||
- ubuntu-latest | ||
- windows-latest | ||
exclude: | ||
- os: macos-latest | ||
node-version: 14.21.3 | ||
runs-on: "${{ matrix.os }}" | ||
steps: | ||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
- name: "Use Node.js ${{ matrix.node-version }}" | ||
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 | ||
with: | ||
node-version: "${{ matrix.node-version }}" | ||
- name: Update Version | ||
if: ${{ inputs.electron-version != '' }} | ||
run: node script/update-version.js ${{ inputs.electron-version }} | ||
- name: Use Latest Electron Version | ||
if: ${{ inputs.electron-version == '' }} | ||
run: echo "ELECTRON_CHROMEDRIVER_STABLE_FALLBACK=1" >> $GITHUB_ENV | ||
- name: Install Dependencies | ||
run: npm ci | ||
- name: Run Tests | ||
run: | | ||
node --version | ||
npm --version | ||
npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters