Merge pull request #481 from asciidoctor/dependabot/github_actions/up… #1014
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Build and Deploy" | |
on: | |
## Events from external actor, or from code pushed (includes tags pushed) | |
push: | |
branches: | |
- '*' | |
tags: | |
- '*' | |
pull_request: | |
jobs: | |
build: | |
# In the future it would be good to run the tests on amd64 and arm64 | |
# This will require one of these: | |
# https://github.blog/changelog/2023-10-30-accelerate-your-ci-cd-with-arm-based-hosted-runners-in-github-actions/ | |
# https://github.com/marketplace/actions/arm-runner | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build | |
run: | | |
make build | |
- name: Install dependencies for Tests | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y --no-install-recommends bats | |
- name: Test | |
run: make test | |
- name: Generate README | |
run: make README | |
#### Deployment Zone: only on main branch (or tags) | |
- name: Login to Docker Hub for Deployment | |
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: github.ref_name == 'main' || github.ref_type == 'tag' | |
run: | | |
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" | |
make deploy-README deploy |