50 lines
2.2 KiB
YAML
50 lines
2.2 KiB
YAML
on:
|
|
release:
|
|
types:
|
|
- published
|
|
jobs:
|
|
build-artifacts:
|
|
runs-on: docker
|
|
container:
|
|
image: iceshrimp.dev/iceshrimp/ci-env:dotnet-wasm
|
|
options: |
|
|
--volume /opt/iceshrimp-cache/nuget:/root/.nuget
|
|
--volume /root/.docker:/root/.docker
|
|
steps:
|
|
- name: Clone repository
|
|
run: git clone ${{ github.event.repository.clone_url }} --branch=${{ github.ref_name }} --depth=1 .
|
|
- name: Print environment info
|
|
run: dotnet --info
|
|
- name: Build release artifacts
|
|
run: make release-artifacts ARCHIVE_BASENAME=${{ github.event.repository.name }} ARCHIVE_VERSION=${{ github.ref_name }} VERBOSE=true
|
|
- name: Upload artifacts
|
|
uses: actions/release-action@main
|
|
with:
|
|
files: artifacts/**
|
|
api_key: '${{secrets.RELEASE_TOKEN}}'
|
|
- name: Set environment variables
|
|
shell: bash
|
|
run: |
|
|
# First, we set the docker repository we want to push to
|
|
REPO="iceshrimp.dev/${GITHUB_REPOSITORY@L}"
|
|
|
|
# We always want to tag :{version} and :pre, but only tag :latest for stable releases, and (temporarily) v2024.1-beta releases
|
|
TAGS="-t $REPO:$GITHUB_REF_NAME -t $REPO:pre"
|
|
|
|
# The first section below can be safely removed once v2024.1 hits stable
|
|
if [[ "$GITHUB_REF_NAME" == "v2024.1-beta"* ]]; then
|
|
TAGS="$TAGS -t $REPO:latest"
|
|
elif [[ "$GITHUB_REF_NAME" == *"-beta"* ]] || [[ "$GITHUB_REF_NAME" == *"-pre"* ]]; then
|
|
:
|
|
else
|
|
TAGS="$TAGS -t $REPO:latest"
|
|
fi
|
|
|
|
# Finally, we pass the computed tags back to the actions environment
|
|
echo "TAGS=$TAGS" >> "${GITHUB_ENV}"
|
|
- name: Build docker image
|
|
run: |
|
|
docker login iceshrimp.dev -u ${{ github.actor }} -p ${{ secrets.REGISTRY_TOKEN }}
|
|
docker buildx create --name iceshrimp-ci 2>&1 &>/dev/null || true
|
|
docker buildx build ${{ env.TAGS }} --provenance=false --platform=linux/amd64,linux/arm64 --push --builder iceshrimp-ci -f ./.docker/dotnet-runner-8.0.Dockerfile ./release
|
|
docker buildx prune --keep-storage 20G --builder iceshrimp-ci
|