File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Docker Image CI
2+
3+ on :
4+ push :
5+ branches : [ "main" ]
6+ pull_request :
7+ branches : [ "main" ]
8+
9+ jobs :
10+ build :
11+ runs-on : ubuntu-latest
12+ permissions :
13+ contents : read
14+ packages : write
15+
16+ steps :
17+ - uses : actions/checkout@v4
18+
19+ - name : Log in to Container registry
20+ if : github.event_name == 'push'
21+ uses : docker/login-action@v3
22+ with :
23+ registry : ghcr.io
24+ username : ${{ github.actor }}
25+ password : ${{ secrets.GITHUB_TOKEN }}
26+
27+ - name : Build Docker image
28+ run : |
29+ tag=$(date +%Y%m%d)
30+ if [[ "${{ github.event.head_commit.message }}" =~ \[latest\] ]]; then
31+ tag=latest
32+ fi
33+ docker build . --tag ghcr.io/restsend/restsend:$tag
34+
35+ - name : Push Docker image
36+ if : github.event_name == 'push'
37+ run : |
38+ tag=$(date +%Y%m%d)
39+ if [[ "${{ github.event.head_commit.message }}" =~ \[latest\] ]]; then
40+ tag=latest
41+ docker push ghcr.io/restsend/restsend:$tag
42+ fi
You can’t perform that action at this time.
0 commit comments