Skip to content

Commit

Permalink
ci add publish action
Browse files Browse the repository at this point in the history
  • Loading branch information
AngryMaciek committed May 14, 2023
1 parent 1ee598f commit 479cc77
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: publish

on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'

jobs:

publish:
name: DockerHub
runs-on: ubuntu-latest

steps:
- name: Check out source repository
uses: actions/checkout@v3

- name: Build Docker image
run: docker build -t angrymaciek/angry-runner:latest .

- name: Publish image to DockerHub
env:
docker_username: ${{ secrets.DOCKER_USERNAME }}
docker_password: ${{ secrets.DOCKER_PASSWORD }}
run: |
repo_name="angry-runner"
tag=$(grep -E 'version=".+"' Dockerfile | grep -oE '[0-9.]+')
echo $docker_password | docker login -u $docker_username --password-stdin
docker tag angrymaciek/${repo_name} angrymaciek/${repo_name}:${tag}
docker push angrymaciek/${repo_name}:latest
docker push angrymaciek/${repo_name}:${tag}
...
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
FROM ubuntu:22.04

# Set metadata
LABEL version="1.0.0"
LABEL maintainer="Maciek Bak"

# Set the non-root user
ARG USERNAME=angryuser
ARG USER_UID=1000
Expand Down

0 comments on commit 479cc77

Please sign in to comment.