2023-08-16 17:22:54 +10:00
|
|
|
name: Build Docker
|
|
|
|
run-name: Build Docker Images
|
|
|
|
on: [push]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
Build Master:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
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 : |
|
|
|
|
cd master
|
|
|
|
echo "${{ secrets.DOCKERGIT_TOKEN }}" | docker login git.woodburn.au -u nathanwoodburn --password-stdin
|
2023-08-24 17:20:35 +10:00
|
|
|
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
|
2023-08-24 17:31:40 +10:00
|
|
|
tag=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
|
2023-08-24 17:43:02 +10:00
|
|
|
tag=${tag//\//-}
|
2023-08-25 13:37:24 +10:00
|
|
|
tag_num=${GITHUB_RUN_NUMBER}
|
2023-08-25 13:26:41 +10:00
|
|
|
echo "tag_num=$tag_num"
|
2023-08-25 13:21:24 +10:00
|
|
|
|
2023-08-24 18:35:41 +10:00
|
|
|
if [[ "$tag" == "main" ]]; then
|
2023-08-24 17:35:18 +10:00
|
|
|
tag="latest"
|
2023-08-24 17:23:23 +10:00
|
|
|
else
|
2023-08-24 17:38:29 +10:00
|
|
|
tag_num="${tag}-${tag_num}"
|
2023-08-24 17:23:23 +10:00
|
|
|
fi
|
2023-08-24 17:43:02 +10:00
|
|
|
|
2023-08-24 17:20:35 +10:00
|
|
|
|
2023-08-24 17:31:40 +10:00
|
|
|
docker build -t hnshosting-master:$tag_num .
|
|
|
|
docker tag hnshosting-master:$tag_num git.woodburn.au/nathanwoodburn/hnshosting-master:$tag_num
|
|
|
|
docker push git.woodburn.au/nathanwoodburn/hnshosting-master:$tag_num
|
|
|
|
docker tag hnshosting-master:$tag_num git.woodburn.au/nathanwoodburn/hnshosting-master:$tag
|
|
|
|
docker push git.woodburn.au/nathanwoodburn/hnshosting-master:$tag
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-08-24 17:23:23 +10:00
|
|
|
|
2023-08-16 17:43:30 +10:00
|
|
|
|
|
|
|
Build Bot:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
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 : |
|
|
|
|
cd discord-bot
|
|
|
|
echo "${{ secrets.DOCKERGIT_TOKEN }}" | docker login git.woodburn.au -u nathanwoodburn --password-stdin
|
2023-08-24 17:20:35 +10:00
|
|
|
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
|
2023-08-24 17:31:40 +10:00
|
|
|
tag=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
|
2023-08-24 17:43:02 +10:00
|
|
|
tag=${tag//\//-}
|
2023-08-25 13:39:26 +10:00
|
|
|
tag_num=${GITHUB_RUN_NUMBER}
|
2023-08-24 18:35:41 +10:00
|
|
|
if [[ "$tag" == "main" ]]; then
|
2023-08-24 17:35:18 +10:00
|
|
|
tag="latest"
|
2023-08-24 17:23:23 +10:00
|
|
|
else
|
2023-08-24 17:39:44 +10:00
|
|
|
tag_num="${tag}-${tag_num}"
|
2023-08-24 17:31:40 +10:00
|
|
|
fi
|
|
|
|
|
|
|
|
docker build -t hnshosting-bot:$tag_num .
|
|
|
|
docker tag hnshosting-bot:$tag_num git.woodburn.au/nathanwoodburn/hnshosting-bot:$tag_num
|
|
|
|
docker push git.woodburn.au/nathanwoodburn/hnshosting-bot:$tag_num
|
|
|
|
docker tag hnshosting-bot:$tag_num git.woodburn.au/nathanwoodburn/hnshosting-bot:$tag
|
2023-08-25 13:44:13 +10:00
|
|
|
docker push git.woodburn.au/nathanwoodburn/hnshosting-bot:$tag
|