Skip to content

update deploy

update deploy #12

Workflow file for this run

name: Build Image for test
env:
REGISTRY: ghcr.io
IMAGE_NAME: hello
on:
push:
branches: [ master ]
release:
types: [ published ]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Login to GitHub Packages
if: ${{ github.ref_type == 'branch' }}
run: echo "${{ secrets.SECRETS_GITHUB_TOKEN }}" | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
- name: Get Short SHA
if: ${{ github.ref_type == 'branch' }}
run: |
SHORT_SHA=$(echo $GITHUB_SHA | cut -c1-7)
echo "Short SHA: $SHORT_SHA"
echo "::set-output name=short_sha::${SHORT_SHA}
- name: Build images
if: ${{ github.ref_type == 'branch' }}
run: make build ARGS="ghcr.io/${{ github.repository }}/" IMAGE_TAG="$SHORT_SHA" IMAGE_NAME=${{ env.IMAGE_NAME }}
- name: Push images to repository
if: ${{ github.ref_type == 'branch' }}
run: make push ARGS="ghcr.io/${{ github.repository }}/" IMAGE_TAG="$SHORT_SHA" IMAGE_NAME=${{ env.IMAGE_NAME }}
deploy_test:
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy Test
uses: easingthemes/ssh-deploy@main
if: ${{ github.ref_type == 'branch' }}
env:
REMOTE_HOST: ${{ secrets.REMOTE_HOST_TEST }}
REMOTE_USER: ubuntu
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY_TEST }}
SHORT_SHA: ${{ needs.build.outputs.get_short_sha }}
SCRIPT_RUN: |

Check failure on line 57 in .github/workflows/hello.yml

View workflow run for this annotation

GitHub Actions / Build Image for test

Invalid workflow file

The workflow is not valid. .github/workflows/hello.yml (Line: 57, Col: 23): Unrecognized named-value: 'IMAGE_NAME'. Located at position 1 within expression: IMAGE_NAME
docker ps |grep ${{ IMAGE_NAME }} && docker stop ${{ env.IMAGE_NAME }} && docker rm ${{ env.IMAGE_NAME }}
docker login ghcr.io -u $GITHUB_ACTOR -p "${{ secrets.SECRETS_GITHUB_TOKEN }}"
docker run -d --name ${{ env.IMAGE_NAME }} ghcr.io/${{ github.repository }}/${{ env.IMAGE_NAME }}:${{ SHORT_SHA }}