woodburn/.gitea/workflows/build.yml

51 lines
1.9 KiB
YAML
Raw Normal View History

2023-07-27 21:59:28 +10:00
name: Build Docker
2023-07-27 22:43:39 +10:00
run-name: Build Docker Image
2023-07-27 21:59:28 +10:00
on: [push]
jobs:
2023-07-27 22:43:39 +10:00
CheckFiles:
2023-07-27 21:59:28 +10:00
runs-on: ubuntu-latest
steps:
2023-07-27 22:43:39 +10:00
- name: Commiter
run: |
echo "Commited by: ${{ gitea.actor }}!"
2023-07-27 21:59:28 +10:00
- name: Checkout
uses: actions/checkout@v2
- name: Check files
run: |
for file in *.html; do
if grep -q "$file" "$file"; then
echo "File $file contains canonical tag with .html!"
exit 1
else
echo "File $file is correct!"
fi
done
2023-07-27 22:43:39 +10:00
Build Docker:
runs-on: ubuntu-latest
2023-07-27 22:48:25 +10:00
needs: CheckFiles
2023-07-27 22:43:39 +10:00
steps:
- name: Checkout
uses: actions/checkout@v2
2023-07-28 14:48:52 +10:00
- name: Install Docker
2023-07-27 21:59:28 +10:00
run : |
2023-07-27 22:26:01 +10:00
apt-get install ca-certificates curl gnupg
2023-07-27 22:29:59 +10:00
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
2023-07-27 22:26:01 +10:00
apt-get update
2023-07-27 22:30:39 +10:00
apt-get install docker-ce-cli -y
2023-07-28 14:48:52 +10:00
- name: Build Docker image
run : |
2023-07-27 21:59:28 +10:00
echo "${{ secrets.DOCKERGIT_TOKEN }}" | docker login git.woodburn.au -u nathanwoodburn --password-stdin
2023-07-28 14:33:16 +10:00
tag_num=$(git rev-parse --short HEAD)
docker build -t woodburn:$tag_num .
docker tag woodburn:$tag_num git.woodburn.au/nathanwoodburn/woodburn:$tag_num
docker push git.woodburn.au/nathanwoodburn/woodburn:$tag_num
2023-07-28 14:36:50 +10:00
docker tag woodburn:$tag_num git.woodburn.au/nathanwoodburn/woodburn:latest
docker push git.woodburn.au/nathanwoodburn/woodburn:latest
2023-07-28 14:50:23 +10:00
2023-07-27 21:59:28 +10:00