Repository navigation
57 lines (55 loc) · 1.7 KB
/
Copy pathdeploy_dev.yml
File metadata and controls
57 lines (55 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: Deploy to Dev
on:
push:
branches: [dev]
workflow_dispatch:
inputs:
acceptance:
description: 'Deploy to Acceptance (yes/no)?'
required: true
default: 'no'
jobs:
build-publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
DOCKERFILE: Dockerfile
REPLACE_ENV_FILE: deployment/deployment.env
ENV_FILE: .env
TAG: the_website_dev
steps:
- uses: actions/checkout@v2
- name: Replace Appsettings
run: cp ${{env.REPLACE_ENV_FILE}} ${{env.ENV_FILE}}
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: lowercase github.repository
run: echo "OWNER_NAME=`echo ${{github.repository_owner}} | tr '[:upper:]' '[:lower:]'`" >>${GITHUB_ENV}
- name: Build and push Docker images
id: push
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: .
push: true
tags: ghcr.io/${{ env.OWNER_NAME }}/${{ env.TAG }}
- name: Execute remote SSH commands using SSH key
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.PRIVATE_KEY }}
script: ./deployscript.sh ${{ secrets.GITHUB_TOKEN }} ${{ env.TAG }}
test-deploy:
name: Deploy to Test
if: github.event.inputs.acceptance == 'yes'
needs: build-publish
runs-on: ubuntu-latest
steps:
- name: Placeholder
run: ls