-
Notifications
You must be signed in to change notification settings - Fork 2
36 lines (33 loc) · 1.3 KB
/
build-container.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
name: Build the Asbyrgi container (only run as `dkorolev`, not `C5T`!)
on:
workflow_dispatch:
# TEMPORARY!
# push:
env:
GHCR_USERNAME: ${{ github.actor }}
GHCR_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
GIT_COMMIT: ${{ github.sha }} # NOTE(dkorolev): This will not do what it should for PR-based action triggers!
jobs:
build-asbyrgi-container:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Clone
uses: actions/checkout@v3
- name: Set Version
run: |
sed -i "s/__ASBYRGI_VERSION_SET_BY_GITHUB_ACTION_CONTAINER_BUILDER__/${GIT_COMMIT:0:7}/" src/docker_entrypoint.sh
- name: Build the container
run: |
docker build -t "ghcr.io/${GHCR_USERNAME}/asbyrgi:latest" .
- name: Test Version
run: |
docker run -i "ghcr.io/${GHCR_USERNAME}/asbyrgi:latest" asbyrgi_version
- name: Login to GHCR
run: echo "${GHCR_PASSWORD}" | docker login ghcr.io --username "${GHCR_USERNAME}" --password-stdin
- name: Push to GHCR
run: |
docker push "ghcr.io/${GHCR_USERNAME}/asbyrgi:latest"
docker tag "ghcr.io/${GHCR_USERNAME}/asbyrgi:latest" "ghcr.io/${GHCR_USERNAME}/asbyrgi:${GIT_COMMIT:0:7}"
docker push "ghcr.io/${GHCR_USERNAME}/asbyrgi:${GIT_COMMIT:0:7}"