Skip to content

fix: github token

fix: github token #8

name: Xquare Deploy for Production
on:
push:
branches:
- main
paths:
- "services/**"
env:
SERVICE_TYPE: fe
jobs:
get-versioning:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ubuntu-latest
outputs:
type: ${{ steps.versioning.outputs.type }}
steps:
- name: Check Out The Repository
uses: actions/checkout@v3
with:
token: ${{ secrets.GHP_TOKEN }}
- name: Get Prefix By Commit
id: get_commit_prefix
run: echo $(echo "${{ github.event.head_commit.message }}" | cut -d ":" -f 1 | cut -d "(" -f 1 | cut -d " " -f 1)
- name: Parse xquare-versioning.json
id: parse_xquare_versioning
run: |
content=`cat ./xquare-versioning.json`
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
echo "::set-output name=xquareVersioning::$content"
- name: Get Do Versioning
id: versioning
run: |
echo "::set-output name=type::${{ fromJson(steps.parse_xquare_versioning.outputs.xquareVersioning).commit.fix }}"
get-diff-workspace:
needs: get-versioning
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Check Out The Repository
uses: actions/checkout@v3
with:
fetch-depth: '2'
token: ${{ secrets.GHP_TOKEN }}
- name: diff-workspace
id: set-matrix
run: echo "::set-output name=matrix::{\"workspaces\":[$(yarn changed list --git-range $(git rev-parse HEAD^) --json --exclude xquare-frontend --exclude @shared/xbridge | tr "\n" ",")]}"
build:
permissions:
id-token: write
contents: read
name: Build
needs: [get-diff-workspace, get-versioning]
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.get-diff-workspace.outputs.matrix) }}
steps:
- name: Check Out The Repository
uses: actions/checkout@v3
with:
token: ${{ secrets.GHP_TOKEN }}
- name: Get Service
id: get_service
run: echo ::set-output name=SERVICE::$(echo ${{ matrix.workspaces.name }} | cut -d / -f 2)
- name: Sync Package Version
run: yarn workspace @service/${{ steps.get_service.outputs.SERVICE }} version ${{ needs.get-versioning.outputs.type }}
- name: Get Package Version
id: package-version
uses: martinbeentjes/npm-get-version-action@main
with:
path: ${{ matrix.workspaces.location }}
- name: Deploy to xquare
uses: team-xquare/xquare-deployment-action@master
with:
environment: prod
xquare_role_arn: ${{ secrets.XQUARE_ROLE_ARN }}
github_token: ${{ secrets.GHP_TOKEN }}
base_url: services/${{ steps.get_service.outputs.SERVICE }}
config_file_path: services/${{ steps.get_service.outputs.SERVICE }}/.xquare/config.yaml
- name: Pull Commit
run: git pull
- name: Commit With Versioning
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "release(${{steps.get_service.outputs.SERVICE}}): ${{ steps.package-version.outputs.current-version }} [skip ci]"
branch: main
commit_options: '--no-verify --signoff'
repository: .
commit_user_name: XQUARE Frontend Bot
commit_user_email: [email protected]
commit_author: XQUARE Frontend Bot <[email protected]>