Skip to content

chore(deps): update actions/cache action to v4 #325

chore(deps): update actions/cache action to v4

chore(deps): update actions/cache action to v4 #325

name: Preview-Deploy
on:
pull_request: {}
env:
ENVIRONMENT: test
OPENSHIFT_API: https://api.cloudscale-lpg-2.appuio.cloud:6443
HELM_RELEASE_NAME: odootools-pr-${{ github.event.number }}
REGISTRY_URL: registry.cloudscale-lpg-2.appuio.cloud
IMG_TAG: pr-${{ github.event.number }}
NAMESPACE: vshn-odoo-test
jobs:
install:
runs-on: ubuntu-latest
if: ${{ !startsWith(github.head_ref, 'renovate/') }}
environment: preview
steps:
- uses: actions/checkout@v4
- name: Determine Go version from go.mod
run: echo "GO_VERSION=$(go mod edit -json | jq -r .Go)" >> $GITHUB_ENV
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Setup helmfile
uses: mamezou-tech/[email protected]
with:
helm-version: v3.7.1
helmfile-version: v0.142.0
install-kubectl: false
- name: Install CLI tools from OpenShift Mirror
uses: redhat-actions/openshift-tools-installer@v1
with:
oc: "4"
- name: Authenticate and set context
uses: redhat-actions/oc-login@v1
with:
openshift_server_url: ${{ env.OPENSHIFT_API }}
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}
namespace: ${{ env.NAMESPACE }}
- name: Docker login
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY_URL }}
username: ${{ github.repository_owner }}
password: ${{ secrets.OPENSHIFT_TOKEN }}
- name: Build and push image
run: make preview.push -e IMG_TAG=${{ env.IMG_TAG }}
- name: Deploy app
run: helmfile -f envs/helmfile.yaml -e ${{ env.ENVIRONMENT }} apply --wait
env:
HELM_RELEASE_NAME: ${{ env.HELM_RELEASE_NAME }}
IMG_TAG: ${{ env.IMG_TAG }}
GIT_SHA: ${{ github.event.pull_request.head.sha }}
ODOO_DB: ${{ secrets.ODOO_DB }}
SECRET_KEY: ${{ secrets.SECRET_KEY }}
- name: Gather status
run: |
echo "ROUTE_HOST=$(oc -n ${{ env.NAMESPACE }} get route ${{ env.HELM_RELEASE_NAME }} -o jsonpath='{.spec.host}')" >> $GITHUB_ENV
- name: Make comment in PR
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ github.event.number }}
body: |
## 🚀 Preview deployment active
| | |
|-|-|
**App URL** | https://${{ env.ROUTE_HOST }}
**Revision** | ${{ github.event.pull_request.head.sha }}
**Helm release** | ${{ env.NAMESPACE }}/${{ env.HELM_RELEASE_NAME }}
**Cluster** | ${{ env.OPENSHIFT_API }}
To uninstall this deployment, close or merge this PR.