Skip to content

Commit

Permalink
Update dockerimage.yml
Browse files Browse the repository at this point in the history
Pushing to GitHub Package Registry
  • Loading branch information
vasilev authored Jan 21, 2020
1 parent c56deea commit e050758
Showing 1 changed file with 31 additions and 8 deletions.
39 changes: 31 additions & 8 deletions .github/workflows/dockerimage.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,37 @@
name: Docker Image CI
name: Build Docker Image

on: [push]
on:
push:
tags:
- v*

jobs:

build:

# Push image to GitHub Package Registry.
build-and-push:
runs-on: ubuntu-latest
if: github.event_name == 'push'

steps:
- uses: actions/checkout@v1
- name: Build the Docker image
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)
- uses: actions/checkout@v2

- name: Build the Docker image
run: docker build . --file Dockerfile --tag vasilev/palemoon

- name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin

- name: Push image
run: |
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/palemoon
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag vasilev/palemoon $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION

0 comments on commit e050758

Please sign in to comment.