-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (45 loc) · 1.56 KB
/
Copy pathci.yml
File metadata and controls
53 lines (45 loc) · 1.56 KB
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
50
51
52
53
name: CI
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
if: github.actor != 'github-actions[bot]' # Prevent running if GitHub Actions made the push
permissions:
contents: write
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Replace placeholder with current date
run: |
DATE=`date +'%Y-%m-%d'`
sed -i 's|<span class="last-update-date">.*</span>|<span class="last-update-date">'$DATE'</span>|' index.html
git config --global user.name 'GitHub Actions'
git config --global user.email 'actions@github.com'
git add index.html
if git diff --cached --quiet
then
echo "No changes to commit"
else
git commit -m "Update index.html with current date"
git push origin HEAD:main
fi
- name: Login to GitHub Container Registry
uses: docker/login-action@v3.1.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
run: |
VERSION=${{ github.event.release.tag_name }}
IMAGE_NAME=ghcr.io/genpat-it/spread
docker build . --file Dockerfile --tag $IMAGE_NAME:$VERSION --tag $IMAGE_NAME:latest
docker push $IMAGE_NAME:$VERSION
docker push $IMAGE_NAME:latest