Skip to content

Commit

Permalink
Build and push Docker image test
Browse files Browse the repository at this point in the history
  • Loading branch information
r4ulcl committed Dec 6, 2023
1 parent 2fab47c commit d12f00f
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions .github/workflows/docker-image-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,19 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Fetch Tags
run: git fetch --tags

- name: Get latest tag
id: get_tag
run: |
latest_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "v1.4")
echo "Latest tag: $latest_tag"
echo "::set-output name=tag::$latest_tag"
- name: Login to GitHub Packages
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login -u ${{ github.actor }} docker.pkg.github.com --password-stdin

- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ secrets.DOCKERHUB_USERNAME }}/wifi_db

- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
name: r4ulcl/wifi_db:latest
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
tag: ${{ steps.get_tag.outputs.tag }}
context: .
push: true
tags: ghcr.io/${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit d12f00f

Please sign in to comment.