Skip to content

Commit

Permalink
Set conditional rules
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikmonsen committed Apr 19, 2024
1 parent d0ab9e4 commit f43b371
Showing 1 changed file with 13 additions and 36 deletions.
49 changes: 13 additions & 36 deletions .github/workflows/ci_pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: CI/CD Pipeline

on: [push]
# push:
# branches:
# - "**"
# tags:
# - "v*.*.*"
# pull_request:
# branches:
# - "main"
on:
push:
branches:
- "**"
tags:
- "v*.*.*"
pull_request:
branches:
- "main"

env:
APP_VERSION: ${{ github.ref_name }}
Expand Down Expand Up @@ -36,23 +36,10 @@ jobs:
- name: Build application
run: npm run build

# - name: Cache node_modules
# uses: actions/cache@v4
# with:
# path: ~/.npm
# key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
# restore-keys: ${{ runner.os }}-node_modules-
#
# - name: Upload build artifact
# uses: actions/upload-artifact@v4
# with:
# name: next-build
# path: .next

build-and-publish:
name: Create and push Docker image
needs: lint-and-test
# if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
runs-on: [self-hosted, Linux]
steps:
- name: Checkout the repository
Expand All @@ -63,17 +50,6 @@ jobs:
with:
driver: docker

# - name: Restore node_modules from cache
# uses: actions/cache@v4
# with:
# path: node_modules
# key: ${{ runner.os }}-node_modules-
#
# - name: Download build artifact
# uses: actions/download-artifact@v4
# with:
# name: next-build

- name: Import secrets
id: import-secrets
uses: hashicorp/vault-action@v3
Expand Down Expand Up @@ -118,7 +94,7 @@ jobs:
name: Deploy stage environment
needs: build-and-publish
runs-on: [self-hosted, Linux]
# if: github.ref == 'refs/heads/main'
if: github.ref == 'refs/heads/main'
environment: stage
steps:
- name: Checkout the repository
Expand Down Expand Up @@ -152,4 +128,5 @@ jobs:
kubectl config use-context tekst
kubectl config view
kubectl version
kubectl apply -f k8s/stage
kubectl apply -f k8s/stage
kubectl rollout restart deployment hugin-deployment

0 comments on commit f43b371

Please sign in to comment.