Merge pull request #316 from peaqnetwork/dependabot/cargo/zerocopy-0.… #309
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: Build and Publish | |
on: | |
push: | |
branches: | |
- 'dev' | |
tags: | |
- 'peaq-dev-v*' # For the peaq-dev's env in the parchain-launch usage | |
- 'krest-v*' # For the krest env in the parchain-launch usage | |
- 'peaq-v*' | |
jobs: | |
push_to_registry: | |
name: Build and Push Peaq Docker Image to Docker Hub | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: "Free Disk Space (insightsengineering/disk-space-reclaimer)" | |
uses: insightsengineering/[email protected] | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | |
with: | |
images: ${{ secrets.DOCKER_REG_PARACHAIN}} | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=ref,event=tag | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: scripts/Dockerfile | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-20.04 | |
needs: push_to_registry | |
steps: | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | |
with: | |
images: ${{ secrets.DOCKER_REG_PARACHAIN}} | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=ref,event=tag | |
- name: Extract Tag | |
id: image-version | |
run: | | |
input_string=${{ steps.meta.outputs.tags}} | |
tag=$(echo "$input_string" | cut -d ':' -f 2) | |
echo "Extracted Tag: $tag" | |
echo "::set-output name=tag::$tag" | |
- name: executing remote ssh commands using ssh key | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.AUTOTEST_HOST }} | |
username: ${{ secrets.AUTOTEST_USERNAME }} | |
key: ${{ secrets.SSH_KEY_AUTOTEST }} | |
port: ${{ secrets.AUTOTEST_SSH_PORT }} | |
script: | | |
cd /home/jay/parachain-launch/yoyo/ | |
sudo docker rmi ${{ secrets.DOCKER_REG_PARACHAIN}}:${{ steps.image-version.outputs.tag }} | |
sudo docker pull ${{ secrets.DOCKER_REG_PARACHAIN}}:${{ steps.image-version.outputs.tag }} | |
sudo peaqnode_latest=${{ steps.image-version.outputs.tag }} docker compose pull | |
sudo peaqnode_latest=${{ steps.image-version.outputs.tag }} docker compose down -v | |
sudo peaqnode_latest=${{ steps.image-version.outputs.tag }} docker compose up -d --build --remove-orphans | |
test: | |
name: Run Autotest | |
runs-on: ubuntu-20.04 | |
needs: deploy | |
steps: | |
- name: Wait for Block Generation | |
uses: jakejarvis/wait-action@master | |
with: | |
time: '180s' | |
- name: Run Test | |
uses: convictional/[email protected] | |
with: | |
owner: peaqnetwork | |
repo: peaq-network-qa | |
github_token: ${{ secrets.TOKEN_FOR_AUTOTEST }} | |
workflow_file_name: main.yml | |
ref: Parachain-Connection | |
trigger_workflow: true | |
wait_workflow: true | |
# - name: Checkout code from specific branch | |
# uses: actions/checkout@v2 | |
# with: | |
# repository: peaqnetwork/peaq-network-qa | |
# token: ${{ secrets.TOKEN_FOR_AUTOTEST }} | |
# ref: test/1205859619866294_add-test-stage-in-peaqnode-deployment | |
# - name: Run AutoTest | |
# uses: https://github.com/peaqnetwork/peaq-network-qa/blob/test/1205859619866294_add-test-stage-in-peaqnode-deployment/.github/workflows/RunTest.yml |