Merge pull request #414 from lixd/release-1.4 #605
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
# 1.setup node env | |
# 2.build | |
# 3.upload to oss | |
name: build | |
on: | |
push: | |
branches: | |
- 'master' | |
- 'release*' | |
# This ensures that previous jobs for the branch are canceled when the branch is updated. | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: Build and upload | |
runs-on: ubuntu-latest | |
env: | |
GO111MODULE: on | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get branch name | |
id: extract_branch | |
shell: bash | |
run: echo ::set-output name=branch::${GITHUB_REF#refs/heads/} | |
- name: Setup node env and build | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.13 | |
#cache: 'yarn' | |
#cache-dependency-path: yarn.lock | |
- name: Build | |
run: | | |
yarn cache clean | |
yarn config set strict-ssl false | |
rm -rf yarn.lock | |
yarn install | |
yarn run build-with-args true | |
- name: Compress | |
run: | | |
pushd dist | |
curl -O https://oss.kubeclipper.io/kube-console/master/kube-console.tar.gz | |
mkdir kube | |
tar -C kube/ -xvzf kube-console.tar.gz | |
rm -rf kube-console.tar.gz | |
ls -F | xargs tar -zcvf kc-console.tar.gz | |
popd | |
- name: Setup ossutil | |
uses: manyuanrong/[email protected] | |
with: | |
endpoint: ${{ secrets.OSS_ENDPOINT }} | |
access-key-id: ${{ secrets.OSS_ACCESS_KEY }} | |
access-key-secret: ${{ secrets.OSS_ACCESS_SECRET }} | |
- name: Upload to oss | |
run: | | |
ossutil cp -rf dist/kc-console.tar.gz oss://${{ secrets.OSS_BUCKET }}/kc-console/${{ steps.extract_branch.outputs.branch }}/ |