woodburn/.gitea/workflows/build.yml
Nathan Woodburn 858610d3a8
Some checks failed
Build Docker / FixFiles (push) Successful in 6s
Build Docker / CheckFiles (push) Failing after 6s
Build Docker / Build Docker (push) Has been skipped
Build Docker / Build ARM Docker (push) Has been skipped
feat: Add analytics
2023-12-13 12:56:10 +11:00

89 lines
3.3 KiB
YAML

name: Build Docker
run-name: Build Docker Image
on: [push]
jobs:
FixFiles:
runs-on: ubuntu-latest
steps:
- name: Commiter
run: |
echo "Commited by: ${{ gitea.actor }}!"
- name: Checkout
uses: actions/checkout@v2
- name: Fix files
run: |
for file in *.html; do
sed -i 's/\.html//g' "$file"
done
CheckFiles:
runs-on: ubuntu-latest
needs: FixFiles
steps:
- name: Commiter
run: |
echo "Commited by: ${{ gitea.actor }}!"
- 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
Build Docker:
runs-on: [ubuntu-latest, amd]
needs: CheckFiles
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Docker
run : |
apt-get install ca-certificates curl gnupg
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
apt-get update
apt-get install docker-ce-cli -y
- name: Build Docker image
run : |
echo "${{ secrets.DOCKERGIT_TOKEN }}" | docker login git.woodburn.au -u nathanwoodburn --password-stdin
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
docker tag woodburn:$tag_num git.woodburn.au/nathanwoodburn/woodburn:latest
docker push git.woodburn.au/nathanwoodburn/woodburn:latest
Build ARM Docker:
runs-on: [ubuntu-latest, arm]
needs: CheckFiles
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Docker
run : |
apt-get install ca-certificates curl gnupg
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
apt-get update
apt-get install docker-ce-cli -y
- name: Build Docker image
run : |
echo "${{ secrets.DOCKERGIT_TOKEN }}" | docker login git.woodburn.au -u nathanwoodburn --password-stdin
tag_num=$(git rev-parse --short HEAD)
docker build -t woodburn:$tag_num .
docker tag woodburn:$tag_num git.woodburn.au/nathanwoodburn/woodburn:arm
docker push git.woodburn.au/nathanwoodburn/woodburn:arm