Bump the dependencies group across 1 directory with 23 updates #53
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 Dev | |
permissions: | |
contents: read | |
pull-requests: write | |
actions: write | |
on: | |
pull_request_target: | |
types: | |
- opened | |
- synchronize | |
- closed | |
branches: | |
- main | |
jobs: | |
### | |
# Image build | |
### | |
build: | |
# ensure that build is only triggered when PR is opened by maintainer or dependabot | |
if: > | |
github.event.action != 'closed' && | |
(github.repository_owner == github.event.pull_request.head.repo.owner.login || | |
(github.actor == 'dependabot[bot]' && | |
github.event.sender.type == 'Bot' && | |
github.event.sender.login == 'dependabot[bot]')) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to Docker Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: registry.l4rs.net | |
username: github | |
password: ${{ secrets.REGISTRY_PASSWORD }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: Dockerfile | |
push: true | |
platforms: linux/amd64 | |
tags: | | |
registry.l4rs.net/hilars-dev:${{ github.sha }} | |
- name: Log out from Docker Registry | |
run: docker logout registry.l4rs.net | |
### | |
# Deploy to Kubernetes | |
### | |
deploy: | |
if: github.event.action != 'closed' | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
- name: Setup helmfile | |
uses: mamezou-tech/setup-helmfile@v2.0.0 | |
- name: Authenticate to Kubernetes cluster | |
run: | | |
echo ${{ secrets.K8S_SERVICE_ACCOUNT_TOKEN }} | kubectl config set-credentials github --token=$(cat -) | |
kubectl config set-cluster k8s-cluster --server=https://k8sp01.l4rs.net:6443 \ | |
--certificate-authority=chart/k8sp01-ca.crt | |
kubectl config set-context hilars-dev --cluster=k8s-cluster --user=github | |
kubectl config use-context hilars-dev | |
- name: Deploy to Kubernetes using Helmfile | |
run: | | |
RELEASE_NAME="hilars-dev-pr-${{ github.event.pull_request.number }}" helmfile apply \ | |
--set image=registry.l4rs.net/hilars-dev:${{ github.sha }} \ | |
--namespace hilars-dev \ | |
--set ingress.url="hilars-dev-pr-${{ github.event.pull_request.number }}.k8s.l4rs.net" \ | |
--set ingress.redirect_wwww=false | |
- name: Comment PR | |
uses: thollander/actions-comment-pull-request@v2 | |
with: | |
message: | | |
The deployment for this PR is available at: https://hilars-dev-pr-${{ github.event.pull_request.number }}.k8s.l4rs.net | |
pr_number: ${{ github.event.pull_request.number }} | |
### | |
# Delete Deployment on PR Close/Merge | |
### | |
delete_deployment: | |
if: github.event.action == 'closed' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
- name: Setup helmfile | |
uses: mamezou-tech/setup-helmfile@v2.0.0 | |
- name: Authenticate to Kubernetes cluster | |
run: | | |
echo ${{ secrets.K8S_SERVICE_ACCOUNT_TOKEN }} | kubectl config set-credentials github --token=$(cat -) | |
kubectl config set-cluster k8s-cluster --server=https://k8sp01.l4rs.net:6443 \ | |
--certificate-authority=chart/k8sp01-ca.crt | |
kubectl config set-context hilars-dev --cluster=k8s-cluster --user=github | |
kubectl config use-context hilars-dev | |
- name: Delete Kubernetes Deployment using Helmfile | |
run: | | |
RELEASE_NAME="hilars-dev-pr-${{ github.event.pull_request.number }}" helmfile destroy |