Skip to content

Commit

Permalink
Use bash variable substitution for docker tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Petrausch committed Apr 21, 2020
1 parent bdb825f commit 8e5df10
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/dockerimage.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
name: Docker Image CI

on:
push:
branches: ["master"]
pull_request:

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Build the Docker image
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)
run: docker build . --file Dockerfile --tag mqtt2prometheus:${GITHUB_REF##*/}
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Release docker file
- name: Build the Docker image
run: docker build -t docker.pkg.github.com/hikhvar/mqtt2prometheus/mqtt2prometheus:latest -t docker.pkg.github.com/hikhvar/mqtt2prometheus/mqtt2prometheus:${{ github.ref }} .
run: docker build -t docker.pkg.github.com/hikhvar/mqtt2prometheus/mqtt2prometheus:latest -t docker.pkg.github.com/hikhvar/mqtt2prometheus/mqtt2prometheus:${GITHUB_REF##*/} .
- name: Login to Github
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
- name: Publish image
run: docker push docker.pkg.github.com/hikhvar/mqtt2prometheus:latest docker.pkg.github.com/hikhvar/mqtt2prometheus:${{ github.ref }}
run: docker push docker.pkg.github.com/hikhvar/mqtt2prometheus:latest docker.pkg.github.com/hikhvar/mqtt2prometheus:${GITHUB_REF##*/}

0 comments on commit 8e5df10

Please sign in to comment.