Update .github/workflows/web-deploy-prod.yml
This commit is contained in:
parent
f40c5f0277
commit
b357250af8
1 changed files with 86 additions and 86 deletions
172
.github/workflows/web-deploy-prod.yml
vendored
172
.github/workflows/web-deploy-prod.yml
vendored
|
|
@ -1,87 +1,87 @@
|
||||||
name: Web Deployment Production
|
name: Web Deployment Production
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
inputs:
|
inputs:
|
||||||
environments:
|
environments:
|
||||||
type: string
|
type: string
|
||||||
description: An optional list of environments to deploy to.
|
description: An optional list of environments to deploy to.
|
||||||
default: 'prod'
|
default: 'prod'
|
||||||
workflow_type:
|
workflow_type:
|
||||||
type: string
|
type: string
|
||||||
description: An optional string for workflow types.
|
description: An optional string for workflow types.
|
||||||
default: 'prod'
|
default: 'prod'
|
||||||
branch:
|
branch:
|
||||||
type: string
|
type: string
|
||||||
description: An optional string to define which branch to checkout.
|
description: An optional string to define which branch to checkout.
|
||||||
default: 'main'
|
default: 'main'
|
||||||
current_version:
|
current_version:
|
||||||
type: string
|
type: string
|
||||||
description: Current Version of the package.json.
|
description: Current Version of the package.json.
|
||||||
default: '0.0.0'
|
default: '0.0.0'
|
||||||
secrets:
|
secrets:
|
||||||
DOCKERHUB_USER: {}
|
DOCKERHUB_USER: {}
|
||||||
DOCKERHUB_TOKEN: {}
|
DOCKERHUB_TOKEN: {}
|
||||||
TEST: {}
|
TEST: {}
|
||||||
TEAMCITY_WEB_ID: {}
|
TEAMCITY_WEB_ID: {}
|
||||||
TEAMCITY_URL: {}
|
TEAMCITY_URL: {}
|
||||||
TEAMCITY_USERNAME: {}
|
TEAMCITY_USERNAME: {}
|
||||||
TEAMCITY_PASSWORD: {}
|
TEAMCITY_PASSWORD: {}
|
||||||
jobs:
|
jobs:
|
||||||
check-inputs:
|
check-inputs:
|
||||||
runs-on: 'ubuntu-latest'
|
runs-on: 'ubuntu-latest'
|
||||||
environment: ${{ inputs.environments }}
|
environment: ${{ inputs.environments }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check secrets present
|
- name: Check secrets present
|
||||||
run: |
|
run: |
|
||||||
if [[ -z "${{ secrets.DOCKERHUB_USER }}" ]]; then
|
if [[ -z "${{ secrets.DOCKERHUB_USER }}" ]]; then
|
||||||
echo "DOCKERHUB_USER secret is empty or missing"
|
echo "DOCKERHUB_USER secret is empty or missing"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "DOCKERHUB_USER secret is set"
|
echo "DOCKERHUB_USER secret is set"
|
||||||
fi
|
fi
|
||||||
if [[ -z "${{ secrets.DOCKERHUB_TOKEN }}" ]]; then
|
if [[ -z "${{ secrets.DOCKERHUB_TOKEN }}" ]]; then
|
||||||
echo "DOCKERHUB_TOKEN secret is empty or missing"
|
echo "DOCKERHUB_TOKEN secret is empty or missing"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "DOCKERHUB_TOKEN secret is set"
|
echo "DOCKERHUB_TOKEN secret is set"
|
||||||
fi
|
fi
|
||||||
echo "Current Version: ${{inputs.current_version}}"
|
echo "Current Version: ${{inputs.current_version}}"
|
||||||
build:
|
build:
|
||||||
needs: check-inputs
|
needs: check-inputs
|
||||||
if: needs.check-inputs.result == 'success' && inputs.workflow_type == 'release'
|
if: needs.check-inputs.result == 'success' && inputs.workflow_type == 'release'
|
||||||
environment: ${{ inputs.environments }}
|
environment: ${{ inputs.environments }}
|
||||||
runs-on: 'ubuntu-latest'
|
runs-on: 'nas'
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
packages: write
|
packages: write
|
||||||
steps:
|
steps:
|
||||||
- name: Branch Checkout
|
- name: Branch Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: ${{ inputs.branch }}
|
ref: ${{ inputs.branch }}
|
||||||
- name: Login to Docker
|
- name: Login to Docker
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: docker.io
|
registry: docker.io
|
||||||
username: ${{ secrets.DOCKERHUB_USER }}
|
username: ${{ secrets.DOCKERHUB_USER }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
- name: Docker Build Backend
|
- name: Docker Build Backend
|
||||||
run: docker build -f Dockerfile -t john4064/matchmaking:prod_web ./ --build-arg ENVIRONMENT=prod
|
run: docker build -f Dockerfile -t john4064/matchmaking:prod_web ./ --build-arg ENVIRONMENT=prod
|
||||||
- name: Docker Push Backend
|
- name: Docker Push Backend
|
||||||
run: docker push john4064/matchmaking:prod_web
|
run: docker push john4064/matchmaking:prod_web
|
||||||
# deploy:
|
# deploy:
|
||||||
# needs: build
|
# needs: build
|
||||||
# if: needs.build.result == 'success' && inputs.workflow_type == 'release'
|
# if: needs.build.result == 'success' && inputs.workflow_type == 'release'
|
||||||
# environment: ${{ inputs.environments }}
|
# environment: ${{ inputs.environments }}
|
||||||
# runs-on: 'ubuntu-latest'
|
# runs-on: 'ubuntu-latest'
|
||||||
# permissions:
|
# permissions:
|
||||||
# contents: read
|
# contents: read
|
||||||
# packages: write
|
# packages: write
|
||||||
# steps:
|
# steps:
|
||||||
# - name: Deploy to Team City
|
# - name: Deploy to Team City
|
||||||
# run: |
|
# run: |
|
||||||
# curl -u ${{ secrets.TEAMCITY_USERNAME }}:${{ secrets.TEAMCITY_PASSWORD }} \
|
# curl -u ${{ secrets.TEAMCITY_USERNAME }}:${{ secrets.TEAMCITY_PASSWORD }} \
|
||||||
# -X POST \
|
# -X POST \
|
||||||
# -H "Content-Type: application/json" \
|
# -H "Content-Type: application/json" \
|
||||||
# -d '{"buildType": {"id": "${{ secrets.TEAMCITY_WEB_ID }}"}}' \
|
# -d '{"buildType": {"id": "${{ secrets.TEAMCITY_WEB_ID }}"}}' \
|
||||||
# "${{ secrets.TEAMCITY_URL }}/httpAuth/app/rest/buildQueue" > /dev/null
|
# "${{ secrets.TEAMCITY_URL }}/httpAuth/app/rest/buildQueue" > /dev/null
|
||||||
Loading…
Reference in a new issue