Skip to content

add deploy step

add deploy step #7

Workflow file for this run

# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
name: Test, Build, Push, Deploy
on:
push:
branches: [ "main", "master", "dev" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ github.repository }}
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
deploy:
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Deploy to Dev
if: github.ref == 'refs/heads/dev'
run: |
curl -f \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: Bearer ${{ secrets.ACTIONS_GITHUB_PAT_DANIEL }}" \
--data '{"event_type": "deploy-dev"}' \
https://api.github.com/repos/ordinalsbot/infra/dispatches
- name: Deploy to Testnet
if: github.ref == 'refs/heads/dev'
run: |
curl -f \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: Bearer ${{ secrets.ACTIONS_GITHUB_PAT_DANIEL }}" \
--data '{"event_type": "deploy-testnet-public"}' \
https://api.github.com/repos/ordinalsbot/infra/dispatches
- name: Deploy to Staging
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
run: |
curl -f \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: Bearer ${{ secrets.ACTIONS_GITHUB_PAT_DANIEL }}" \
--data '{"event_type": "deploy-stage"}' \
https://api.github.com/repos/ordinalsbot/infra/dispatches