Skip to content

Commit

Permalink
Update build-and-deploy.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
dduportal authored Mar 12, 2024
1 parent 2bd6643 commit 8962b3a
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,10 @@ on:
## Events from external actor, or from code pushed (includes tags pushed)
push:
branches:
- main
- 'refs/tags/*'
- '*'
tags:
- '*'

pull_request:
## Events from the GitHub UI (as when publishing a release)
# When a release is "released" (draft or released published, no pre-release) - https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#release
release:
types: [released]
# When a tag or branch is created in the GitHub UI
create:
jobs:
build:
# In the future it would be good to run the tests on amd64 and arm64
Expand All @@ -40,15 +32,15 @@ jobs:
run: make README
#### Deployment Zone: only on main branch (or tags)
- name: Login to Docker Hub for Deployment
if: startsWith('refs/tag', github.ref) || startsWith('refs/heads/main', github.ref)
if: github.ref_name == 'main' || github.ref_type == 'tag'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Deploy
if: startsWith('refs/tag', github.ref) || startsWith('refs/heads/main', github.ref)
if: github.ref_name == 'main' || github.ref_type == 'tag'
run: |
export IMAGE_VERSION="$(echo ${GITHUB_REF#refs/tags/} | grep -v 'refs/heads')"
export IMAGE_VERSION="${{ github.ref_name }}"
export IMAGE_NAME="asciidoctor/docker-asciidoctor"
git config --local user.name "${GITHUB_ACTOR}"
git config --local user.email "${GITHUB_ACTOR}@users.noreply.github.com"
Expand Down

0 comments on commit 8962b3a

Please sign in to comment.