This commit is contained in:
parent
466c9ef7be
commit
a8d4b11132
3 changed files with 73 additions and 45 deletions
|
@ -1,56 +1,38 @@
|
|||
on: [push]
|
||||
env:
|
||||
REGISTRY: forgejo.sbox.hornwitser.no
|
||||
REGISTRY_IMAGE: forgejo.sbox.hornwitser.no/furnavia/builder
|
||||
REGISTRY: forge.hornwitser.no
|
||||
REGISTRY_IMAGE: forge.hornwitser.no/furnavia/builder
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: node:20-bookworm
|
||||
runs-on: alpine
|
||||
steps:
|
||||
-
|
||||
name: Install docker
|
||||
name: Install buildah
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y --no-install-recommends ca-certificates curl git
|
||||
install -m 0755 -d /etc/apt/keyrings
|
||||
curl -sSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
|
||||
chmod a+r /etc/apt/keyrings/docker.asc
|
||||
echo \
|
||||
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] \
|
||||
https://download.docker.com/linux/debian \
|
||||
bookworm stable" \
|
||||
> /etc/apt/sources.list.d/docker.list
|
||||
apt-get update
|
||||
apt-get install -y --no-install-recommends docker-ce-cli docker-buildx-plugin docker-compose-plugin
|
||||
apk add buildah
|
||||
-
|
||||
name: Get image tags
|
||||
name: Compute image tags
|
||||
id: info
|
||||
shell: bash
|
||||
run: |
|
||||
tee -a ${GITHUB_OUTPUT} <<EOF
|
||||
TAGS<<EOT
|
||||
$(
|
||||
echo ${{ env.REGISTRY_IMAGE }}:${{ github.ref_name }}
|
||||
if [[ "${{ github.ref_name }}" =~ ^r[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo ${{ env.REGISTRY_IMAGE }}:latest
|
||||
elif [[ "${{ github.ref_name }}" == forgejo ]]; then
|
||||
echo ${{ env.REGISTRY_IMAGE }}:development
|
||||
fi
|
||||
)
|
||||
EOT
|
||||
TAGS=${{ env.REGISTRY_IMAGE }}:${{ github.ref_name }}
|
||||
EOF
|
||||
-
|
||||
name: Authenticate
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||
registry: ${{ env.REGISTRY }}
|
||||
name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
name: Build
|
||||
run: |
|
||||
id
|
||||
$GITHUB_WORKSPACE/builder.sh ${{ steps.info.outputs.TAGS }}
|
||||
-
|
||||
name: Authenticate with registry
|
||||
run: |
|
||||
echo "${{ secrets.REGISTRY_TOKEN }}" | buildah login ${{ env.REGISTRY }} --username "${{ secrets.REGISTRY_USERNAME }}" --password-stdin
|
||||
-
|
||||
name: Push
|
||||
with:
|
||||
push: true
|
||||
tags: ${{ steps.info.outputs.TAGS }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue