Skip to content

Commit

Permalink
should resolve #41 [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
csae8092 committed Jul 22, 2022
1 parent ee3619d commit bd34055
Showing 1 changed file with 38 additions and 17 deletions.
55 changes: 38 additions & 17 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,46 @@
name: Publish and Deploy
name: Build and publish Docker image

on:
release:
types: [published]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
push_to_registry:
name: Push Docker image to Docker Hub
build-deploy:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v2
- name: docker build
run: docker build -t acdhch/vocabseditor .
- name: docker push
run: |
docker login -u "${{ secrets.DOCKER_USERNAME }}" -p "${{ secrets.DOCKER_PASSWORD }}"
docker push acdhch/vocabseditor
rancher:
needs: push_to_registry
name: Deploy to rancher
runs-on: ubuntu-latest
steps:
- name: Rancher Deploy Action
run: "docker run --rm curlimages/curl:7.74.0 --request POST 'https://rancher.acdh-dev.oeaw.ac.at/v3/project/c-zdbh8:p-44gl8/workloads/deployment:vocabseditor:vocabsmanual?action=redeploy' --header 'Accept: application/json' --header 'Authorization: Bearer ${{ secrets.RANCHER_BARER_TOKEN }}'"
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

0 comments on commit bd34055

Please sign in to comment.