add concurrency block to deploy test stand workflow #132 #10
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: Deploy Test Stand | |
# This workflow is triggered on push to master branch and can be triggered manually. | |
# It deploys app to test stand. | |
on: | |
push: | |
branches: | |
- 'master' | |
workflow_dispatch: | |
inputs: | |
commit: | |
description: 'Commit SHA1' | |
required: false | |
default: '' | |
type: string | |
concurrency: | |
group: ${{ | |
( github.ref == 'refs/heads/master' && | |
format('{0}/{1}', github.run_id, github.run_attempt) ) | |
|| | |
format('{0}/{1}', github.workflow, github.ref) }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
uses: ./.github/workflows/build.yaml | |
secrets: inherit | |
with: | |
environment: test | |
commit: ${{ inputs.commit || github.sha }} | |
update_test_stand: | |
name: Update test stand | |
runs-on: ubuntu-latest | |
environment: test | |
needs: [build] | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: build-${{ github.sha }} | |
- name: Extract build results | |
run: tar -xf build-${{ github.sha }}.tar.gz | |
- name: Install SSH Key | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
key: ${{ secrets.TEST_STAND_SSH_KEY }} | |
known_hosts: 'placeholder' | |
- name: Adding known hosts | |
run: ssh-keyscan -H ${{ secrets.TEST_STAND_HOST }} >> ~/.ssh/known_hosts | |
- name: Deploy on test stand | |
env: | |
HOST: ${{ secrets.TEST_STAND_HOST }} | |
USER: ${{ secrets.TEST_STAND_USER }} | |
TARGET_DIR: '/home/staging/proof.market.nil.foundation.test-stand' | |
OPTIONS: '-avz --progress --delete' | |
run: rsync ${{ env.OPTIONS }} build/ ${{ env.USER }}@${{ env.HOST }}:${{ env.TARGET_DIR }} |