chore(ci): move publish to a separate workflow (#647)

This commit is contained in:
folex 2023-01-20 15:52:17 +07:00 committed by GitHub
parent ab841f81d2
commit 1071d2011d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 225 additions and 209 deletions

221
.github/workflows/publish.yml vendored Normal file
View File

@ -0,0 +1,221 @@
name: "publish-aqua"
on:
workflow_dispatch:
inputs:
version:
description: 'aqua version to publish'
required: true
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
env:
FORCE_COLOR: true
jobs:
compile:
runs-on: builder
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Cache Scala
uses: coursier/cache-action@v6
- name: Setup Scala
uses: coursier/setup-action@v1
with:
apps: sbt
- name: JS CLI build
run: sbt cliJS/fullLinkJS
- name: JS API build
run: sbt aqua-api/fullLinkJS
- name: JS LSP build
run: sbt language-server-api/fullLinkJS
- name: Upload aqua-cli artifact
uses: actions/upload-artifact@v3
with:
name: aqua-cli
path: cli/cli/.js/target/scala-*/cli-opt/main.js
- name: Upload aqua-api artifact
uses: actions/upload-artifact@v3
with:
name: aqua-api
path: api/aqua-api/target/scala-*/aqua-api-opt/main.js
- name: Upload aqua-lsp artifact
uses: actions/upload-artifact@v3
with:
name: aqua-lsp
path: language-server/language-server-api/target/scala-*/language-server-api-opt/main.js
aqua-cli:
name: "Publish aqua-cli"
runs-on: ubuntu-latest
needs:
- compile
permissions:
contents: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Download aqua-cli artifact
uses: actions/download-artifact@v3
with:
name: aqua-cli
- run: mv scala-*/*/main.js cli/cli-npm/aqua.js
- name: Import secrets
uses: hashicorp/vault-action@v2.4.3
with:
url: https://vault.fluence.dev
path: jwt/github
role: ci
method: jwt
jwtGithubAudience: "https://github.com/fluencelabs"
jwtTtl: 300
exportToken: false
secrets: |
kv/npmjs/fluencebot token | NODE_AUTH_TOKEN
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: "16"
registry-url: "https://registry.npmjs.org"
cache-dependency-path: "cli/cli-npm/package-lock.json"
cache: "npm"
- name: Set version
run: npm version ${{ github.event.inputs.version }}
working-directory: cli/cli-npm
- run: npm i
working-directory: cli/cli-npm
- run: npm run build
working-directory: cli/cli-npm
- name: Publish to NPM registry
run: npm publish --access public
working-directory: cli/cli-npm
aqua-api:
name: "Publish aqua-api"
runs-on: ubuntu-latest
needs:
- compile
permissions:
contents: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Download aqua-api artifact
uses: actions/download-artifact@v3
with:
name: aqua-api
- run: mv scala-*/*/main.js api/aqua-api-npm/aqua-api.js
- name: Import secrets
uses: hashicorp/vault-action@v2.4.3
with:
url: https://vault.fluence.dev
path: jwt/github
role: ci
method: jwt
jwtGithubAudience: "https://github.com/fluencelabs"
jwtTtl: 300
exportToken: false
secrets: |
kv/npmjs/fluencebot token | NODE_AUTH_TOKEN
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: "16"
registry-url: "https://registry.npmjs.org"
cache-dependency-path: "api/aqua-api-npm/package-lock.json"
cache: "npm"
- name: Set version
run: npm version ${{ github.event.inputs.version }}
working-directory: api/aqua-api-npm
- run: npm i
working-directory: api/aqua-api-npm
- name: Publish to NPM registry
run: npm publish --access public
working-directory: api/aqua-api-npm
aqua-lsp:
name: "Publish aqua-lsp"
runs-on: ubuntu-latest
needs:
- compile
permissions:
contents: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Download aqua-lsp artifact
uses: actions/download-artifact@v3
with:
name: aqua-lsp
- run: mv scala-*/*/main.js language-server/language-server-npm/aqua-lsp-api.js
- name: Import secrets
uses: hashicorp/vault-action@v2.4.3
with:
url: https://vault.fluence.dev
path: jwt/github
role: ci
method: jwt
jwtGithubAudience: "https://github.com/fluencelabs"
jwtTtl: 300
exportToken: false
secrets: |
kv/npmjs/fluencebot token | NODE_AUTH_TOKEN
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: "16"
registry-url: "https://registry.npmjs.org"
cache-dependency-path: "language-server/language-server-npm/package-lock.json"
cache: "npm"
- name: Set version
run: npm version ${{ github.event.inputs.version }}
working-directory: language-server/language-server-npm
- run: npm i
working-directory: language-server/language-server-npm
- name: Publish to NPM registry
run: npm publish --access public
working-directory: language-server/language-server-npm

View File

@ -4,7 +4,6 @@ on:
push:
branches:
- "main"
workflow_dispatch:
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
@ -83,213 +82,9 @@ jobs:
commit_user_email: devops@fluence.one
commit_author: fluencebot <devops@fluence.one>
compile:
publish:
if: needs.release-please.outputs.release-created
runs-on: builder
needs: release-please
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Cache Scala
uses: coursier/cache-action@v6
- name: Setup Scala
uses: coursier/setup-action@v1
with:
apps: sbt
- name: JS CLI build
run: sbt cliJS/fullLinkJS
- name: JS API build
run: sbt aqua-api/fullLinkJS
- name: JS LSP build
run: sbt language-server-api/fullLinkJS
- name: Upload aqua-cli artifact
uses: actions/upload-artifact@v3
with:
name: aqua-cli
path: cli/cli/.js/target/scala-*/cli-opt/main.js
- name: Upload aqua-api artifact
uses: actions/upload-artifact@v3
with:
name: aqua-api
path: api/aqua-api/target/scala-*/aqua-api-opt/main.js
- name: Upload aqua-lsp artifact
uses: actions/upload-artifact@v3
with:
name: aqua-lsp
path: language-server/language-server-api/target/scala-*/language-server-api-opt/main.js
aqua-cli:
name: "Publish aqua-cli"
runs-on: ubuntu-latest
needs:
- release-please
- compile
permissions:
contents: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Download aqua-cli artifact
uses: actions/download-artifact@v3
with:
name: aqua-cli
- run: mv scala-*/*/main.js cli/cli-npm/aqua.js
- name: Import secrets
uses: hashicorp/vault-action@v2.4.3
with:
url: https://vault.fluence.dev
path: jwt/github
role: ci
method: jwt
jwtGithubAudience: "https://github.com/fluencelabs"
jwtTtl: 300
exportToken: false
secrets: |
kv/npmjs/fluencebot token | NODE_AUTH_TOKEN
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: "16"
registry-url: "https://registry.npmjs.org"
cache-dependency-path: "cli/cli-npm/package-lock.json"
cache: "npm"
- name: Set version
run: npm version ${{ needs.release-please.outputs.version }}
working-directory: cli/cli-npm
- run: npm i
working-directory: cli/cli-npm
- run: npm run build
working-directory: cli/cli-npm
- name: Publish to NPM registry
run: npm publish --access public
working-directory: cli/cli-npm
aqua-api:
name: "Publish aqua-api"
runs-on: ubuntu-latest
needs:
- release-please
- compile
permissions:
contents: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Download aqua-api artifact
uses: actions/download-artifact@v3
with:
name: aqua-api
- run: mv scala-*/*/main.js api/aqua-api-npm/aqua-api.js
- name: Import secrets
uses: hashicorp/vault-action@v2.4.3
with:
url: https://vault.fluence.dev
path: jwt/github
role: ci
method: jwt
jwtGithubAudience: "https://github.com/fluencelabs"
jwtTtl: 300
exportToken: false
secrets: |
kv/npmjs/fluencebot token | NODE_AUTH_TOKEN
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: "16"
registry-url: "https://registry.npmjs.org"
cache-dependency-path: "api/aqua-api-npm/package-lock.json"
cache: "npm"
- name: Set version
run: npm version ${{ needs.release-please.outputs.version }}
working-directory: api/aqua-api-npm
- run: npm i
working-directory: api/aqua-api-npm
- name: Publish to NPM registry
run: npm publish --access public
working-directory: api/aqua-api-npm
aqua-lsp:
name: "Publish aqua-lsp"
runs-on: ubuntu-latest
needs:
- release-please
- compile
permissions:
contents: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Download aqua-lsp artifact
uses: actions/download-artifact@v3
with:
name: aqua-lsp
- run: mv scala-*/*/main.js language-server/language-server-npm/aqua-lsp-api.js
- name: Import secrets
uses: hashicorp/vault-action@v2.4.3
with:
url: https://vault.fluence.dev
path: jwt/github
role: ci
method: jwt
jwtGithubAudience: "https://github.com/fluencelabs"
jwtTtl: 300
exportToken: false
secrets: |
kv/npmjs/fluencebot token | NODE_AUTH_TOKEN
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: "16"
registry-url: "https://registry.npmjs.org"
cache-dependency-path: "language-server/language-server-npm/package-lock.json"
cache: "npm"
- name: Set version
run: npm version ${{ needs.release-please.outputs.version }}
working-directory: language-server/language-server-npm
- run: npm i
working-directory: language-server/language-server-npm
- name: Publish to NPM registry
run: npm publish --access public
working-directory: language-server/language-server-npm
uses: ./.github/workflows/publish.yml
with:
version: ${{ needs.release-please.outputs.version }}