-
Notifications
You must be signed in to change notification settings - Fork 70
49 lines (42 loc) · 1.25 KB
/
create_api.yml
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
name: Create Container API
on:
workflow_dispatch:
branches: [ main ]
release:
types: [ "published" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Extract tag name # Extract tag name based on event type
id: tag_name
run: |
if [[ $GITHUB_EVENT_NAME == 'release' ]]; then
echo "tag=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_ENV
else
echo "tag=latest" >> $GITHUB_ENV
fi
shell: bash
- name: Login to dockerhub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker images
uses: docker/build-push-action@v2
with:
tags: |
dustinupdyke/ghosts:${{ env.tag }}
dustinupdyke/ghosts:latest
push: true
context: src/.
file: ./src/Dockerfile-api
- name: Save Docker image as tar
run: |
docker save dustinupdyke/ghosts:latest > ghosts-api.tar
- name: Upload TAR file as artifact
uses: actions/upload-artifact@v4
with:
name: ghosts-api
path: ghosts-api.tar