Skip to content

Commit

Permalink
Refactor GitHub Actions workflows for Docker image publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
mfranzil committed May 2, 2024
1 parent 764462d commit 74c3b4a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 26 deletions.
28 changes: 3 additions & 25 deletions .github/workflows/docker-ghcr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,18 @@ name: Publish Docker Image on GHCR - GitHub Container Registry
# documentation.

on:
# schedule:
# - cron: '24 21 * * *'
push:
branches: [ "rising" ]
tags: [ 'v*.*.*' ]
pull_request:
branches: [ "rising" ]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
IMAGE_BASE_NAME: fluidos-energy-predictor
ORG_NAME: risingfbk
BASE_BRANCH: rising

ORG_NAME: ${{ github.repository_owner }}
BASE_BRANCH: ${{ github.ref }}

jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
Expand Down Expand Up @@ -88,22 +81,7 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max


# Sign the resulting Docker image digest except on PRs.
# This will only write to the public Rekor transparency log when the Docker
# repository is public to avoid leaking data. If you would like to publish
# transparency data even for private images, pass --force to cosign below.
# https://github.com/sigstore/cosign
# - name: Sign the published Docker image
# if: ${{ github.event_name != 'pull_request' }}
# env:
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
# TAGS: ${{ steps.meta.outputs.tags }}
#DIGEST: ${{ steps.build-and-push.outputs.digest }}
# This step uses the identity token to provision an ephemeral certificate
# against the sigstore community Fulcio instance.
#run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
platforms: linux/amd64,linux/arm64

clean:
name: Clean up unused images
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/docker-hub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,17 @@ env:
ORG_NAME: fluidos
BASE_BRANCH: github


jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check if the repository is "fluidos/energy-predictor"
run: |
if [ "${{ github.repository }}" != "fluidos/energy-predictor" ]; then
echo "This workflow is only for the fluidos/energy-predictor repository."
exit 0
fi
- name: Check out the repo
uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -63,6 +68,7 @@ jobs:
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.BASE_BRANCH }} , ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.GIT_TAG }} , ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64

# - name: Build Docker image with local git tag
# run: |
Expand Down

0 comments on commit 74c3b4a

Please sign in to comment.