diff options
| author | Miquel Sabaté Solà <msabate@suse.com> | 2024-03-13 22:06:46 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <msabate@suse.com> | 2024-03-14 14:09:07 +0100 |
| commit | 90feff2bfcbdb5586a459c2350a4172a4423668e (patch) | |
| tree | 00217c407bcf0c1179355e1c6d052551a039e24e /.github | |
| parent | a7791635aa98f012d35f97c3c5288494bbb28e38 (diff) | |
| download | operum-90feff2bfcbdb5586a459c2350a4172a4423668e.tar.gz operum-90feff2bfcbdb5586a459c2350a4172a4423668e.zip | |
ci: deploy the built Docker image
Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
Diffstat (limited to '.github')
| -rw-r--r-- | .github/workflows/ci.yml | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 54baa0e..e024ff9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,3 +54,35 @@ jobs: run: | bin/rails test bin/rails test:system + + deploy: + runs-on: ubuntu-latest + needs: [lint, test] + if: github.event_name == 'push' + steps: + - uses: actions/checkout@v2 + + - name: Build production Docker image + run: | + docker build --tag ${{ secrets.REGISTRY_HOST }}/${{ secrets.REGISTRY_USERNAME }}/operum:main . + + - name: Push Docker image + run: | + # The login is done with the default docker password storage, which is + # not the safest around, but it will be removed by a subsequent logout + # later on. + docker login -u "${{ secrets.REGISTRY_USERNAME }}" -p "${{ secrets.REGISTRY_PASSWORD }}" ${{ secrets.REGISTRY_HOST }} + docker push ${{ secrets.REGISTRY_HOST }}/${{ secrets.REGISTRY_USERNAME }}/operum:main + docker logout ${{ secrets.REGISTRY_HOST }} + + # The server provides a small script named `service-restart` which will do + # the right thing to pull the new image of the desired service and re-run + # it. + - name: Restart service with the new code + uses: garygrossgarten/github-action-ssh@release + with: + command: infra-restart operum + host: ${{ secrets.REMOTE_HOST }} + username: ${{ secrets.REMOTE_USERNAME }} + passphrase: ${{ secrets.REMOTE_PASSPHRASE }} + privateKey: ${{ secrets.PRIVATE_KEY}} |
