Skip to content

Commit

Permalink
[!] add docker job to the Release workflow, closes #446 (#448)
Browse files Browse the repository at this point in the history
* add tag_semver: true
* add `docker` job to the `Release` workflow
* fix `pgwatch2_git_version` on WebUI versions page, fixes #447
* add `latest` tag to released docker images
  • Loading branch information
pashagolub authored Jan 25, 2022
1 parent 2910495 commit 431ed06
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 12 deletions.
43 changes: 35 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
name: Release
on:
push:
# ignore all branches
branches-ignore:
- '*'
- '*'
# run for every tag with version string
tags:
- v[0-9]+.[0-9]+.[0-9]+*

jobs:
build:

goreleaser:
if: true # false to skip job during debug
runs-on: ubuntu-latest
name: goreleaser
steps:

- name: Set up Golang
uses: actions/setup-go@v2
with:
go-version: '1.14'
go-version: '1.17'

- name: Check out code into the Go module directory
uses: actions/checkout@v2
Expand All @@ -27,13 +31,36 @@ jobs:
with:
args: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

docker:
if: true # false to skip job during debug
strategy:
fail-fast: true
matrix:
image: ['', '-postgres', '-nonroot', '-daemon', '-db-bootstrapper']
runs-on: ubuntu-latest
steps:

- name: Check out code
uses: actions/checkout@v2

- name: Version strings
id: version
run: |
echo "::set-output name=RELEASE_VERSION::$(echo "$GITHUB_REF_NAME#${GITHUB_SHA:0:6}")"
echo "::set-output name=RELEASE_TIME::$(git show -s --format=%cI HEAD)"
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@master
env:
GIT_HASH: ${{ steps.version.outputs.RELEASE_VERSION }}
GIT_TIME: ${{ steps.version.outputs.RELEASE_TIME }}
with:
name: cybertecpostgresql/pgwatch2-nonroot
dockerfile: docker/Dockerfile-nonroot
name: cybertec/pgwatch2${{ matrix.image }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
tag_semver: true
dockerfile: docker/Dockerfile${{ matrix.image }}
buildargs: GIT_HASH,GIT_TIME
tags: "latest"
tag_semver: true
File renamed without changes.
3 changes: 0 additions & 3 deletions docker/Dockerfile-nonroot
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,6 @@ RUN pip3 install psutil pyyaml

ADD grafana_dashboards /pgwatch2/grafana_dashboards

# For showing all component versions via :8080/versions. Assuming project is cloned from Github here
COPY .git/refs/heads/master /pgwatch2/build_git_version.txt

# Set up supervisord [https://docs.docker.com/engine/admin/using_supervisord/]
COPY supervisord-nonroot.conf /etc/supervisor/supervisord.conf

Expand Down
1 change: 0 additions & 1 deletion docker/Dockerfile-postgres
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ RUN echo "${GIT_HASH} ${GIT_TIME}" > /pgwatch2/build_git_version.txt
RUN cp /pgwatch2/bootstrap/grafana_custom_config.ini /etc/grafana/grafana.ini \
&& pip3 install -r /pgwatch2/webpy/requirements_pg_metrics.txt \
&& pip2 install psutil \
&& echo "$GIT_HASH" > /pgwatch2/build_git_version.txt \
&& grafana-cli plugins install savantly-heatmap-panel \
&& pip3 install supervisor pyyaml && mkdir /var/log/supervisor

Expand Down

0 comments on commit 431ed06

Please sign in to comment.