chore(infra): add npm deploy (#636) #214
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
name: Release | |
on: | |
push: | |
branches: | |
- main | |
# manual trigger | |
workflow_dispatch: | |
jobs: | |
release: | |
runs-on: | |
group: npm-deploy | |
environment: | |
name: production | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./.github/actions/setup | |
- run: yarn prepare | |
- run: yarn prei18n:compile | |
- uses: crowdin/[email protected] | |
with: | |
upload_sources: true | |
download_translations: true | |
create_pull_request: false | |
push_translations: false | |
localization_branch_name: main | |
source: 'src/locales/en-US.po' | |
translation: 'src/locales/%locale%.po' | |
crowdin_branch_name: widgets | |
token: ${{ secrets.CROWDIN_TOKEN }} | |
project_id: 458284 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- run: yarn i18n:compile | |
- run: yarn test | |
if: success() | |
env: | |
JSON_RPC_PROVIDER: ${{ secrets.JSON_RPC_PROVIDER }} | |
- name: Load secret | |
uses: 1password/load-secrets-action@581a835fb51b8e7ec56b71cf2ffddd7e68bb25e0 | |
with: | |
# Export loaded secrets as environment variables | |
export-env: true | |
env: | |
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} | |
# You may need to change this to your vault name and secret name | |
# Refer to it by calling env.NPM_TOKEN | |
# This token is also limited by IP to ONLY work on the runner | |
NPM_TOKEN: op://npm-deploy/npm-runner-token/secret | |
- run: yarn release | |
if: success() | |
env: | |
NPM_CONFIG_USERCONFIG: /dev/null | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ env.NPM_TOKEN }} |