fusionSeriesAsset: use quantity when creating asset #75
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: "[${GITHUB_REF#refs/heads/}] Build and Push to GHCR" | |
on: | |
push: | |
branches: | |
- main | |
- prod | |
jobs: | |
next-build: | |
name: Buid Image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.GHCR_USERNAME }} | |
password: ${{ secrets.GHCR_TOKEN }} | |
- name: Build and Push Docker Image | |
env: | |
PROD_ENV_FILE: ${{ secrets.PROD_ENV_FILE }} | |
run: | | |
echo "$PROD_ENV_FILE" > .env | |
export CURRENT_BRANCH=${GITHUB_REF#refs/heads/} | |
export TAG=$([[ $CURRENT_BRANCH == $(basename ${{ github.ref }}) ]] && echo $CURRENT_BRANCH || echo "latest") | |
echo $TAG | |
export GITHUB_REF_IMAGE=ghcr.io/$GITHUB_REPOSITORY:$GITHUB_SHA | |
export GITHUB_BRANCH_IMAGE=ghcr.io/$GITHUB_REPOSITORY:$TAG | |
export GITHUB_REF_IMAGE=$(echo $GITHUB_REF_IMAGE | tr '[:upper:]' '[:lower:]') | |
export GITHUB_BRANCH_IMAGE=$(echo $GITHUB_BRANCH_IMAGE | tr '[:upper:]' '[:lower:]') | |
docker build --build-arg version=$GITHUB_SHA -t $GITHUB_REF_IMAGE -t $GITHUB_BRANCH_IMAGE . | |
echo "Pushing Image to GitHub Container Registry" | |
docker push $GITHUB_REF_IMAGE | |
docker push $GITHUB_BRANCH_IMAGE | |
rm -rf .env | |
ghcr-push: | |
needs: next-build # Job depends on next-build(above) job | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy on Dev server | |
if: github.ref == 'refs/heads/prod' | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.PROD_REMOTE_SERVER_ADDRESS }} | |
username: ${{ secrets.DEV_SERVER_USERNAME }} | |
key: ${{ secrets.DEV_REMOTE_SERVER_KEY }} | |
port: ${{ secrets.DEV_SSH_PORT }} | |
script: | | |
pwd | |
cd ~ | |
docker stop launchpad && docker rm launchpad && docker image rm launchpad | |
echo ${{ secrets.GHCR_TOKEN }} | podman login ghcr.io -u secrets.GHCR_USERNAME --password-stdin | |
docker pull ghcr.io/myriadflow/launchpad:prod | |
docker run --name="launchpad" -p 9082:3000 -d ghcr.io/myriadflow/launchpad:prod |