Deploy #2595
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: Deploy | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [labeled, synchronize] | |
workflow_dispatch: | |
env: | |
WERF_ENV: "production" | |
WERF_REPO: "ghcr.io/${{ github.repository_owner }}/werfio-guides" | |
WERF_STAGES_STORAGE: "ghcr.io/werf/werfio-guides-stages" | |
WERF_SET_ACTIVE_RELEASE: "global.active_release=2" | |
WERFIO_GITHUB_TOKEN: "${{ secrets.API_TOKEN }}" | |
jobs: | |
converge: | |
name: Deploy | |
if: github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'test website') || contains(github.event.pull_request.labels.*.name, 'stage website') | |
runs-on: ubuntu-latest-4-cores | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Generate artifacts | |
if: github.ref == 'refs/heads/main' | |
run: | | |
cd .werf/artifacts | |
bash generate_artifacts.sh | |
- name: Install werf | |
uses: werf/actions/install@v2 | |
- name: Deploy to test | |
if: contains(github.event.pull_request.labels.*.name, 'test website') | |
run: | | |
. $(werf ci-env github --as-file) | |
werf converge | |
env: | |
WERF_NAMESPACE: "werfio-test" | |
WERF_RELEASE: "werfio-site-test" | |
WERF_LOG_VERBOSE: "on" | |
WERF_ENV: "test" | |
WERF_KUBE_CONFIG_BASE64: ${{ secrets.KUBECONFIG_BASE64_DEV }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Deploy to stage | |
if: contains(github.event.pull_request.labels.*.name, 'stage website') | |
run: | | |
. $(werf ci-env github --as-file) | |
werf converge | |
env: | |
WERF_NAMESPACE: "werfio-stage" | |
WERF_RELEASE: "werfio-site-stage" | |
WERF_LOG_VERBOSE: "on" | |
WERF_ENV: "stage" | |
WERF_KUBE_CONFIG_BASE64: ${{ secrets.KUBECONFIG_BASE64_DEV }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Deploy to production | |
if: github.ref == 'refs/heads/main' | |
run: | | |
. $(werf ci-env github --as-file) | |
werf converge | |
env: | |
WERF_NAMESPACE: "werfio-production" | |
WERF_RELEASE: "werfio-site-production" | |
WERF_LOG_VERBOSE: "on" | |
WERF_ENV: "production" | |
WERF_KUBE_CONFIG_BASE64: ${{ secrets.KUBECONFIG_BASE64_PROD }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
notification: | |
name: Notification | |
if: always() | |
needs: converge | |
uses: werf/common-ci/.github/workflows/notification.yml@main | |
secrets: | |
loopNotificationGroup: ${{ secrets.LOOP_NOTIFICATION_GROUP }} | |
webhook: ${{ secrets.LOOP_NOTIFICATION_WEBHOOK }} | |
notificationChannel: ${{ secrets.LOOP_NOTIFICATION_CHANNEL }} |