deployment action work #25
Workflow file for this run
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 docker image | |
on: | |
push: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/build-push-action@v6 | |
with: | |
push: false | |
tags: 'scheme-index:latest' | |
file: ./build/Dockerfile | |
- run: | | |
docker create --name dummy scheme-index:latest | |
docker cp dummy:/schemeindex.zip /tmp/schemeindex.zip | |
docker rm -f dummy | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: schemeindex | |
path: /tmp/schemeindex.zip | |
deploy_ansible: | |
needs: | |
- build | |
runs-on: ubuntu-latest | |
environment: Prod | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: webfactory/ssh-agent@v0.9.0 | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
- uses: actions/download-artifact@v4 | |
with: | |
name: schemeindex | |
path: build | |
- run: | | |
sudo apt-get install ansible | |
ssh-keyscan -t rsa index.scheme.org >> ~/.ssh/known_hosts | |
cd deploy | |
ansible-playbook -i hosts deploy.yml -e content_zip_file=$GITHUB_WORKSPACE/build/schemeindex.zip | |