Skip to content

Bump actions/cache from 3.3.1 to 4.1.2 #1830

Bump actions/cache from 3.3.1 to 4.1.2

Bump actions/cache from 3.3.1 to 4.1.2 #1830

Workflow file for this run

name: Build and deploy (pull request)
on:
pull_request:
types: [synchronize, reopened, labeled]
env:
RELEASE_NAME: website-pr-${{ github.event.pull_request.number }}
CHART_VALUES_FILE: .helm/values.pr.yml
DEPLOY_NAMESPACE: sledilnik-pr
DEPLOY_ENV: pr-${{ github.event.pull_request.number }}
DEPLOY_URL: https://pr-${{ github.event.pull_request.number }}.preview.sledilnik.org
IMAGE_TAG: pr-${{ github.event.pull_request.number }}
INGRESS_RULE: Host(`pr-${{ github.event.pull_request.number }}.preview.sledilnik.org`)
jobs:
test:
runs-on: ubuntu-20.04
steps:
- name: Debug
uses: hmarr/[email protected]
- name: Checkout repo
uses: actions/checkout@v4
- uses: actions/[email protected]
with:
node-version: '18'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/[email protected]
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn
- run: yarn lint
# - run: yarn test
- run: yarn dotnet-restore
- run: yarn test-fsharp
build:
if: contains(github.event.pull_request.labels.*.name, 'deploy-preview')
needs: test
runs-on: ubuntu-20.04
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to ghcr.io
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Build and push docker container image
uses: docker/build-push-action@v4
with:
push: true
context: .
file: ./Dockerfile
tags: |
ghcr.io/${{ github.repository_owner }}/website:${{ env.IMAGE_TAG}}
build-args: |
BUILD_MODE=staging
deploy:
runs-on: ubuntu-20.04
if: contains(github.event.pull_request.labels.*.name, 'deploy-preview')
needs: build
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Deploy
uses: sledilnik/[email protected]
with:
chartName: sledilnik/website
chartVersion: '1.0.0'
kubeconfig: '${{ secrets.KUBECONFIG }}'
- name: Slack notification
uses: 8398a7/action-slack@v3
with:
icon_url: 'https;//github.com/sledilnik.png?size=32'
author_name: 'Deploy bot'
status: custom
fields: repo,workflow,job
custom_payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "PR-${{ github.event.pull_request.number}} deploy finished with status: ${{ job.status }}"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "URL: ${{ env.DEPLOY_URL }}"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}