Skip to content

Commit

Permalink
Update nightly.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
sergi0g authored Oct 25, 2024
1 parent 186f44c commit 0182396
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@ on:
workflow_dispatch:

jobs:
get-tag:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.tag.outputs.tag }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get Docker image tag
id: tag
run: |
if [ "${GITHUB_REF_NAME}" == "main" ]; then
TAG="nightly"
else
TAG="${GITHUB_REF_NAME}-nightly"
fi
echo "tag=$TAG" >> $GITHUB_ENV
build-binaries:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -45,6 +61,7 @@ jobs:
cup-linux-arm64
build-image:
needs: get-tag
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -63,29 +80,19 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Get Docker image tag
id: tag
run: |
if [ "${GITHUB_REF_NAME}" == "main" ]; then
TAG="nightly"
else
TAG="${GITHUB_REF_NAME}-nightly"
fi
echo "tag=$TAG" >> $GITHUB_ENV
- name: Build and push image
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64, linux/arm64
push: true
tags: ghcr.io/sergi0g/cup:${{ steps.tag.outputs.tag }}
tags: ghcr.io/sergi0g/cup:${{ needs.get-tag.outputs.tag }}
cache-from: type=gha
cache-to: type=gha,mode=max

nightly-release:
runs-on: ubuntu-latest
needs: build-binaries
needs: [build-binaries, get-tag]
steps:
- name: Download binaries
uses: actions/download-artifact@v4
Expand All @@ -96,6 +103,6 @@ jobs:
- uses: pyTooling/Actions/releaser@r0
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: nightly
tag: ${{ needs.get-tag.outputs.tag }}
rm: true
files: binaries/*

0 comments on commit 0182396

Please sign in to comment.