Skip to content

Commit

Permalink
CI: GitHub: build Docker images
Browse files Browse the repository at this point in the history
Pushes to master should create a "development" tag. Tags should create
something prettier.

We need the git checkout for proper package versioning, hence that magic
`context` thing, and also that magic `echo`.

Change-Id: I79fcb800cc079e8486c3795f36aa1993676cee49
  • Loading branch information
jktjkt committed Jun 9, 2021
1 parent 11dab61 commit 2c3b0d8
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,43 @@ jobs:
include:
- tox_env: docs
dnf_install: graphviz

docker:
needs: build
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v'))
name: Docker image
runs-on: ubuntu-latest
steps:
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: jktjkt
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Extract tag name
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
id: extract_pretty_git
run: echo ::set-output name=GIT_DESC::$(git describe --tags)
- name: Build and push a container
uses: docker/build-push-action@v2
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
with:
context: .
push: true
tags: |
telecominfraproject/oopt-gnpy:dev-${{ steps.extract_pretty_git.outputs.GIT_DESC }}
telecominfraproject/oopt-gnpy:master
- name: Extract tag name
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
id: extract_tag_name
run: echo ::set-output name=GIT_DESC::${GITHUB_REF/refs\/tags\//}
- name: Build and push a container
uses: docker/build-push-action@v2
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
with:
context: .
push: true
tags: |
telecominfraproject/oopt-gnpy:${{ steps.extract_tag_name.outputs.GIT_DESC }}

0 comments on commit 2c3b0d8

Please sign in to comment.