Commonize builds, add staging build #3
@@ -1,4 +1,4 @@
|
||||
name: Build and Test
|
||||
name: Build and Test - Production
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
@@ -89,4 +89,4 @@ jobs:
|
||||
-H 'accept: */*' \
|
||||
-H 'Authorization: Bearer ${{ secrets.TRUENAS_CAPERRENCOM_API_KEY }}' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '"caperren-com"'
|
||||
-d '"caperren-com"'
|
||||
90
.gitea/workflows/build-staging.yaml
Normal file
90
.gitea/workflows/build-staging.yaml
Normal file
@@ -0,0 +1,90 @@
|
||||
name: Build and Test - Staging
|
||||
on:
|
||||
pull_request:
|
||||
types: [ opened, synchronize, reopened ]
|
||||
|
||||
jobs:
|
||||
determine_version:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
repo_name: ${{ steps.project_metadata.outputs.REPO_NAME }}
|
||||
repo_version_hash: ${{ steps.project_metadata.outputs.REPO_VERSION_HASH }}
|
||||
project_version: ${{ steps.project_metadata.outputs.PROJECT_VERSION }}
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node Environment
|
||||
uses: actions/setup-node@v4
|
||||
|
||||
- name: Acquire Project Metadata
|
||||
id: project_metadata
|
||||
run: |
|
||||
echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT
|
||||
echo REPO_VERSION_HASH=$(git describe --tags --always | sed 's/^v//') >> $GITHUB_OUTPUT
|
||||
echo PROJECT_VERSION=$(npm pkg get version --workspaces=false | tr -d \") >> $GITHUB_OUTPUT
|
||||
|
||||
build_and_push:
|
||||
runs-on: ubuntu-latest
|
||||
needs: determine_version
|
||||
steps:
|
||||
- name: Checkout caperren-com Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: caperren-com
|
||||
|
||||
- name: Login to Docker Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: gitea.perren.cloud
|
||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.ACTIONS_TOKEN }}
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build and Push
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: caperren-com
|
||||
push: true
|
||||
tags: |
|
||||
gitea.perren.cloud/caperren/caperren-com:latest-staging
|
||||
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build_and_push
|
||||
steps:
|
||||
- run: echo "Placeholder"
|
||||
|
||||
deploy_staging:
|
||||
runs-on: ubuntu-latest
|
||||
needs: test
|
||||
steps:
|
||||
- name: Pull New Image For App
|
||||
run: |
|
||||
curl -k -X 'POST' \
|
||||
'https://caperren.com:444/api/v2.0/app/pull_images' \
|
||||
-H 'accept: */*' \
|
||||
-H 'Authorization: Bearer ${{ secrets.TRUENAS_CAPERRENCOM_API_KEY }}' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"name": "caperren-com-stg",
|
||||
"options": {}
|
||||
}'
|
||||
- name: Stop App
|
||||
run: |
|
||||
curl -k -X 'POST' \
|
||||
'https://caperren.com:444/api/v2.0/app/stop' \
|
||||
-H 'accept: */*' \
|
||||
-H 'Authorization: Bearer ${{ secrets.TRUENAS_CAPERRENCOM_API_KEY }}' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '"caperren-com-stg"'
|
||||
- name: Start App
|
||||
run: |
|
||||
curl -k -X 'POST' \
|
||||
'https://caperren.com:444/api/v2.0/app/stop' \
|
||||
-H 'accept: */*' \
|
||||
-H 'Authorization: Bearer ${{ secrets.TRUENAS_CAPERRENCOM_API_KEY }}' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '"caperren-com-stg"'
|
||||
Reference in New Issue
Block a user