feat: change forgejo actions
This commit is contained in:
parent
74dbef2506
commit
68013cc2e7
3 changed files with 64 additions and 58 deletions
|
@ -1,4 +1,4 @@
|
|||
name: Build and push dyndns-netcup
|
||||
name: build container image
|
||||
|
||||
on:
|
||||
push:
|
||||
|
@ -6,31 +6,59 @@ on:
|
|||
- main
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
release_tag:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Login to Docker Hub
|
||||
|
||||
- name: Install jq
|
||||
run: apt-get update && apt-get upgrade && apt-get install -y jq
|
||||
|
||||
- name: Get latest release and create new release
|
||||
shell: bash
|
||||
run: |
|
||||
# Get latest release.
|
||||
latest_release=$(curl -s https://git.smail.koeln/api/v1/repos/homelab/docker-ownDynDNS-netcup/releases\?limit\=1 | jq -r '.[] | .tag_name')
|
||||
|
||||
# Cut release into year, month and counter.
|
||||
year=$(echo $latest_release | awk -F '.' '//{print $1}')
|
||||
month=$(echo $latest_release | awk -F '.' '//{print $2}')
|
||||
counter=$(echo $latest_release | awk -F '.' '//{print $3}')
|
||||
|
||||
# increase the counter, if the release is from the same year and month
|
||||
if [ $(date +'%Y') -eq year ] && [ $(date +'%m') -eq month ]; then
|
||||
((counter++));
|
||||
# else reset counter
|
||||
else
|
||||
counter=1;
|
||||
fi
|
||||
|
||||
# Create
|
||||
new_release=$(date +'%Y').$(date +'mY').$counter
|
||||
echo "RELEASE=$new_release">> $GITHUB_ENV
|
||||
|
||||
build:
|
||||
needs: release_tag
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USER }}
|
||||
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
|
||||
-
|
||||
name: Set up variables
|
||||
run: |
|
||||
VER=$(cat ./docker-build/VERSION)
|
||||
echo "VERSION=$VER" >> $GITHUB_ENV
|
||||
-
|
||||
name: Set up QEMU
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
-
|
||||
name: Build and push
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ./docker-build
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
# Build it yourself
|
||||
|
||||
https://docs.docker.com/buildx/working-with-buildx/#work-with-builder-instances
|
||||
|
||||
```
|
||||
# This creates a new builder instance with a single node based on your current configuration.
|
||||
docker buildx create
|
||||
# To list all available builders, use
|
||||
docker buildx ls
|
||||
# To switch between different builders, use
|
||||
docker buildx use <name>
|
||||
# After creating a new instance, you can delete it with
|
||||
docker buildx rm <name>
|
||||
```
|
||||
|
||||
Build it as a multi-platform image:
|
||||
```
|
||||
chmod +x build_and_push.sh
|
||||
./build_and_push.sh
|
||||
```
|
|
@ -1,2 +0,0 @@
|
|||
docker buildx build --platform linux/arm/v7,linux/arm64/v8,linux/amd64 -t sujiba/docker-owndyndns-netcup:`cat VERSION` --push .
|
||||
docker buildx build --platform linux/arm/v7,linux/arm64/v8,linux/amd64 -t sujiba/docker-owndyndns-netcup:latest --push .
|
Loading…
Add table
Add a link
Reference in a new issue