1 |
rakinar2 |
575 |
name: Docker |
2 |
|
|
|
3 |
|
|
on: [push, pull_request] |
4 |
|
|
|
5 |
|
|
jobs: |
6 |
|
|
build: |
7 |
|
|
runs-on: ubuntu-latest |
8 |
|
|
|
9 |
|
|
steps: |
10 |
rakinar2 |
616 |
- uses: actions/checkout@v4 |
11 |
rakinar2 |
575 |
|
12 |
|
|
- name: Prepare environment |
13 |
|
|
run: echo "DEBUG=1" > .env.docker |
14 |
|
|
|
15 |
|
|
- name: Set Tag |
16 |
|
|
run: echo "$(date +%s)" > TAG |
17 |
|
|
|
18 |
|
|
- name: Build the Docker image |
19 |
|
|
run: docker build . --file Dockerfile --tag ghcr.io/onesoft-sudo/sudobot:$(cat TAG) --tag ghcr.io/onesoft-sudo/sudobot:latest |
20 |
|
|
|
21 |
|
|
- name: Login to GitHub Container Registry |
22 |
|
|
run: echo ${{ secrets.PAT_TOKEN }} | docker login ghcr.io -u virtual-designer --password-stdin |
23 |
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main' |
24 |
|
|
|
25 |
|
|
- name: Push the Docker image |
26 |
|
|
run: docker push ghcr.io/onesoft-sudo/sudobot:$(cat TAG) && docker push ghcr.io/onesoft-sudo/sudobot:latest |
27 |
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main' |