Skip to content

Commit

Permalink
feat(ci): simplify image tag
Browse files Browse the repository at this point in the history
  • Loading branch information
nevivurn committed Aug 24, 2024
1 parent a8d07aa commit 535dd7f
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,10 @@ permissions:
jobs:
build:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.vars.outputs.image-tag }}
application: ${{ steps.vars.outputs.application }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set variables
id: vars
env:
EVENT_NAME: ${{ github.event_name }}
REF_TYPE: ${{ github.ref_type }}
REF_NAME: ${{ github.ref_name }}
GIT_SHA: ${{ github.sha }}
run: |
date="$(date -u +%Y%m%d)"
short_rev="$(git rev-parse --short "$GIT_SHA")"
echo "image-tag=${REF_NAME}" >> $GITHUB_OUTPUT
echo "application=bacchus-snu/snucse" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Configure registry credentials
Expand All @@ -41,11 +25,18 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set variables
uses: docker/metadata-aciton#
id: meta
with:
images: ghcr.io/bacchus-snu/${{ vars.IMAGE_NAME }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ghcr.io/bacchus-snu/${{ vars.IMAGE_NAME }}:${{ steps.vars.outputs.image-tag }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

0 comments on commit 535dd7f

Please sign in to comment.