Skip to content

Commit

Permalink
chore(actions): fix push-docker-image to use official actions
Browse files Browse the repository at this point in the history
  • Loading branch information
akanoce committed Jan 5, 2024
1 parent f259bbf commit 4972a28
Showing 1 changed file with 16 additions and 22 deletions.
38 changes: 16 additions & 22 deletions .github/workflows/push-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ on:
branches:
- master

env:
REGISTRY: ghcr.io
IMAGE_NAME: vechain/insight-app
jobs:
build:
env:
REGISTRY: ghcr.io
IMAGE_NAME: vechain/insight-app
publish:
runs-on: ubuntu-latest
permissions:
contents: read
Expand All @@ -22,23 +22,17 @@ jobs:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Download artifact explorer
uses: actions/download-artifact@v2
with:
name: insight-app
path: /tmp
- name: Load Docker images
run: |
docker load --input /tmp/insight-app.tar
docker image ls -a

- name: Tags images to publish
run: |
timestamp=`date +%s`
docker tag insight-app ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${timestamp}
docker tag insight-app ${{env.REGISTRY}}/${{env.IMAGE_NAME}}
docker tag insight-app ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{github.sha}}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Publish images
run: |
docker push -a ${{env.REGISTRY}}/${{env.IMAGE_NAME}}
- name: Build and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 4972a28

Please sign in to comment.