Skip to content

Commit

Permalink
Add github action
Browse files Browse the repository at this point in the history
  • Loading branch information
jk779 committed Jan 10, 2024
1 parent e596fc9 commit 8bcb377
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/docker_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Update the csp_reporter image

on:
workflow_dispatch:
schedule:
- cron: '20 5 1-31/7 * *'
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build_alpine:
name: Prepare image, remove dev deps, push
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Get date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"

- name: Set outputs
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

# - name: Check outputs
# run: echo ${{ steps.vars.outputs.sha_short }}

- name: Execute Dockerfile
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: .
file: ./Dockerfile
push: true
tags: |
jk779/csp_reporter:${{ steps.date.outputs.date }}-alpine-sha-${{ steps.vars.outputs.sha_short }}
jk779/csp_reporter:${{ steps.date.outputs.date }}-alpine
jk779/csp_reporter:latest-alpine
jk779/csp_reporter:latest
labels: |
build_date=${{ steps.date.outputs.date }}
maintainer="jk779"
source=https://github.com/jk779/csp_reporter
vcs_ref=${{ github.sha }}

0 comments on commit 8bcb377

Please sign in to comment.