Skip to content

Workflow file for this run

on:
push:
branches: [main]
env:
BRANCH: "main"
REGISTRY: "ghcr.io"
IMAGE: "${{ github.repository }}"
REGISTRY_IMAGE: "ghcr.io/${{ github.repository }}"
jobs:
release-create:
permissions: write-all
runs-on: ubuntu-latest
outputs:
release: ${{ steps.release.outputs.release_tag }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- id: release
name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [[ "${{ github.ref }}" == 'refs/heads/main' ]]; then
export GITHUB_OUTPUT=$GITHUB_OUTPUT
bash ./.github/workflows/release.sh "${{ env.BRANCH }}"
else
echo "release_tag=0.0.0" >> $GITHUB_OUTPUT
fi
release-linux-x64:
runs-on: ubuntu-latest
needs: [release-create]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: downcase REPO
run: |
REGISTRY_IMAGE=${{ env.REGISTRY_IMAGE }}
echo "REGISTRY_IMAGE=${REGISTRY_IMAGE,,}" >>${GITHUB_ENV}
IMAGE=${{ env.IMAGE }}
echo "IMAGE=${IMAGE,,}" >>${GITHUB_ENV}
# docker
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker buildx
uses: docker/setup-buildx-action@v3
- name: Login to Github registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY_IMAGE }}
- name: Build and push Docker image
id: docker_build
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true
- name: Download image
run: docker pull "${{ env.REGISTRY_IMAGE}}:main"
- name: Show images
run: docker images
# dockerc
- name: Download dockerc
run: curl -Lo dockerc https://github.com/NilsIrl/dockerc/releases/download/v0.3.2/dockerc_x86-64
- name: Give executable permissions to dockerc
run: chmod +x ./dockerc
- name: Create executable amd64
run: ./dockerc --image "docker-daemon:${{ env.REGISTRY_IMAGE }}:main" -o ./worldtimezone_amd64 --arch amd64
- name: Create executable arm64
run: ./dockerc --image "docker-daemon:${{ env.REGISTRY_IMAGE }}:main" -o ./worldtimezone_arm64 --arch arm64
- name: Show files
run: ls -la .
# upload
- name: Upload To Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ needs.release-create.outputs.release }} "./worldtimezone_amd64"
gh release upload ${{ needs.release-create.outputs.release }} "./worldtimezone_arm64"