54 lines
1.6 KiB
YAML
54 lines
1.6 KiB
YAML
name: Build and Publish Docker Image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Download modpack from release
|
|
run: |
|
|
curl -L -H "Authorization: token ${{ secrets.GIT_PASSWORD }}" \
|
|
-o modpack.zip \
|
|
"https://git.cashew.network/${{ github.repository }}/releases/download/modpack-latest/modpack.zip"
|
|
unzip -q modpack.zip -d modpack
|
|
rm modpack.zip
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to Docker Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: git.cashew.network
|
|
username: ${{ secrets.GIT_USERNAME }}
|
|
password: ${{ secrets.GIT_PASSWORD }}
|
|
|
|
- name: Extract metadata
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: git.cashew.network/${{ github.repository }}
|
|
tags: |
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
type=semver,pattern={{major}}
|
|
type=raw,value=latest
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
cache-from: type=registry,ref=git.cashew.network/${{ github.repository }}:buildcache
|
|
cache-to: type=registry,ref=git.cashew.network/${{ github.repository }}:buildcache,mode=max
|
|
|