Skip to content

Merge pull request #519 from okp4/dependabot/github_actions/actions/a… #315

Merge pull request #519 from okp4/dependabot/github_actions/actions/a…

Merge pull request #519 from okp4/dependabot/github_actions/actions/a… #315

Workflow file for this run

name: Publish
on:
push:
branches: [main]
tags: ['v*']
concurrency:
group: publish-${{ github.ref }}
cancel-in-progress: true
jobs:
publish-docker-images:
runs-on: ubuntu-22.04
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Extract metadata (tags, labels) for Docker
id: docker_metadata
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=raw,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }},value=nightly
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
labels: |
org.opencontainers.image.vendor=OKP4
- name: Login to OKP4 Docker registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ secrets.DOCKER_REGISTRY_ID }}
password: ${{ secrets.DOCKER_REGISTRY_TOKEN }}
- name: Build and publish image(s)
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
push: true
tags: ${{ steps.docker_metadata.outputs.tags }}
labels: ${{ steps.docker_metadata.outputs.labels }}
deploy-k8s-staging:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-22.04
needs:
- publish-docker-images
env:
KUBECTL_VERSION: v1.21.4
DATAVERSE_PORTAL_IMAGE: ghcr.io/okp4/dataverse-portal
steps:
- name: Set up kubectl
run: |
curl -fsSL -o ./kubectl https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/bin/kubectl
- name: Set up kubernetes config
run: |
echo ${{ secrets.KUBECONFIG }} > config_enc
cat config_enc | base64 -d > config
rm config_enc
- name: Deploy staging
run: |
kubectl patch --kubeconfig config deploy dataverse-portal -p '{"spec": {"template": {"metadata": {"labels": {"commit": "${{ github.sha }}"}}}}}' -n staging