Merge pull request #1696 from tactilenews/1386_add_more_context_to_si… #796
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: Continuous Deployment | |
on: | |
push: | |
branches: [ main ] | |
jobs: | |
docker_push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# GitHub Actions do not expose the commit date, so we need to | |
# store it in an env variable ourselves. | |
- name: Get commit date | |
id: git_commit_date | |
run: "echo GIT_COMMIT_DATE=$(git log -1 --format=%cd --date=iso-strict ${{ github.sha }}) >> $GITHUB_ENV" | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: true | |
tags: tactilenews/hundred-eyes:latest | |
build-args: | | |
git_commit_sha=${{ github.sha }} | |
git_commit_date=${{ env.GIT_COMMIT_DATE }} | |
- name: Image digest | |
run: echo ${{ steps.docker_build.outputs.digest }} | |
deploy: | |
needs: [docker_push] | |
runs-on: ubuntu-latest | |
concurrency: staging_environment | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Run playbook | |
uses: dawidd6/action-ansible-playbook@009b88e9b8894bd8838475d799b7dca5024e91d5 | |
with: | |
playbook: ansible/site.yml | |
requirements: ansible/requirements.yml | |
key: ${{secrets.SSH_PRIVATE_KEY}} | |
vault_password: ${{secrets.VAULT_PASSWORD}} | |
options: | | |
--inventory ansible/inventories/staging | |
--skip-tags skip_ci | |
--verbose |