Skip to content

Commit

Permalink
Update ci.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
otherguy committed Jun 26, 2023
1 parent 35da1a3 commit 1687e96
Showing 1 changed file with 34 additions and 13 deletions.
47 changes: 34 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,51 @@ on:
push:
branches:
- 'main'
tags:
- '*'

jobs:
docker:
runs-on: ubuntu-latest
environment: DockerHub
steps:

- name: Checkout
uses: actions/[email protected]
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
uses: docker/login-action@v2
if: GitHub.event_name != 'pull_request'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# - name: Build and push
# id: docker_build
# uses: docker/build-push-action@v2
# with:
# push: true
# tags: user/app:latest
- name: Send GitHub Action data to Slack
uses: act10ns/[email protected]
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

- name: Docker meta
uses: docker/metadata-action@v4
id: meta
with:
images: ${{ secrets.DOCKERHUB_USERNAME }}/dropbox
tags: |
type=raw,value=latest,enable=${{ endsWith(GitHub.ref, 'main') }}
type=ref,event=tag
type=sha,enable=true,priority=100,prefix=,suffix=,format=short
flavor: |
latest=false
- name: Build and push
id: docker_build
uses: docker/build-push-action@v4
with:
status: ${{ job.status }}
push: ${{ GitHub.event_name != 'pull_request' }}
context: .
file: Dockerfile
builder: ${{ steps.buildx.outputs.name }}
build-args: |
BUILD_DATE=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
VCS_REF=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
tags: ${{ steps.meta.outputs.tags }}
images: ${{ secrets.DOCKERHUB_USERNAME }}/dropbox

0 comments on commit 1687e96

Please sign in to comment.