-
Notifications
You must be signed in to change notification settings - Fork 1
40 lines (38 loc) · 1.12 KB
/
publish.yaml
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
name: Publish Docker Images
on: push
jobs:
publish-images:
name: Publish Docker Images
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Extract Branch Name
shell: bash
run: |
APP_TAG=${GITHUB_REF#refs/heads/}
if [[ "$APP_TAG" == 'production' ]]; then
echo '::set-output name=APP_TAG::latest'
else
echo "::set-output name=APP_TAG::$APP_TAG"
fi
id: extract-branch
-
name: Build Images
run: |
export APP_TAG=${{ steps.extract-branch.outputs.APP_TAG }}
docker compose -f compose.yaml build --build-arg GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
-
name: Login to GitHub Packages
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Push Images
run: |
export APP_TAG=${{ steps.extract-branch.outputs.APP_TAG }}
docker compose -f compose.yaml push