|
|
|
@ -1,20 +1,20 @@
|
|
|
|
|
name: Halo Admin CI
|
|
|
|
|
name: Halo Console CI
|
|
|
|
|
|
|
|
|
|
on:
|
|
|
|
|
pull_request:
|
|
|
|
|
branches:
|
|
|
|
|
- next
|
|
|
|
|
- main
|
|
|
|
|
- release-*
|
|
|
|
|
paths:
|
|
|
|
|
- '**'
|
|
|
|
|
- '!**.md'
|
|
|
|
|
- "**"
|
|
|
|
|
- "!**.md"
|
|
|
|
|
push:
|
|
|
|
|
branches:
|
|
|
|
|
- next
|
|
|
|
|
- main
|
|
|
|
|
- release-*
|
|
|
|
|
paths:
|
|
|
|
|
- '**'
|
|
|
|
|
- '!**.md'
|
|
|
|
|
- "**"
|
|
|
|
|
- "!**.md"
|
|
|
|
|
release:
|
|
|
|
|
types:
|
|
|
|
|
- created
|
|
|
|
@ -36,64 +36,3 @@ jobs:
|
|
|
|
|
run: pnpm typecheck
|
|
|
|
|
- name: Run unit test
|
|
|
|
|
run: pnpm test:unit
|
|
|
|
|
|
|
|
|
|
github-release:
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
needs: check
|
|
|
|
|
if: github.event_name == 'release'
|
|
|
|
|
steps:
|
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
- name: Environment Set Up
|
|
|
|
|
uses: halo-sigs/actions/admin-env-setup@main
|
|
|
|
|
- run: pnpm install
|
|
|
|
|
- run: pnpm build:packages
|
|
|
|
|
- name: Build for release
|
|
|
|
|
run: pnpm build
|
|
|
|
|
- name: Compress dist directory
|
|
|
|
|
run: |
|
|
|
|
|
PACKAGE_VERSION=$(sed -nE 's/^\s*"version": "(.*?)",$/\1/p' package.json)
|
|
|
|
|
ARTIFACT_NAME=halo-admin-${PACKAGE_VERSION}.zip
|
|
|
|
|
ARTIFACT_PATHNAME=dist/${ARTIFACT_NAME}
|
|
|
|
|
|
|
|
|
|
echo "Halo admin version $PACKAGE_VERSION"
|
|
|
|
|
echo "Artifact name: ${ARTIFACT_NAME}"
|
|
|
|
|
echo "Artifact pathname: ${ARTIFACT_PATHNAME}"
|
|
|
|
|
echo "PACKAGE_VERSION=${PACKAGE_VERSION}" >> $GITHUB_ENV
|
|
|
|
|
echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV
|
|
|
|
|
echo "ARTIFACT_PATHNAME=${ARTIFACT_PATHNAME}" >> $GITHUB_ENV
|
|
|
|
|
echo "RELEASE_ID=${{ github.event.release.id }}" >> $GITHUB_ENV
|
|
|
|
|
zip -r $ARTIFACT_PATHNAME dist
|
|
|
|
|
|
|
|
|
|
- name: Upload a Release Asset
|
|
|
|
|
uses: actions/github-script@v2
|
|
|
|
|
with:
|
|
|
|
|
github-token: ${{secrets.GITHUB_TOKEN}}
|
|
|
|
|
script: |
|
|
|
|
|
const fs = require('fs').promises;
|
|
|
|
|
const { repo: { owner, repo }, sha } = context;
|
|
|
|
|
console.log({ owner, repo, sha });
|
|
|
|
|
|
|
|
|
|
const releaseId = process.env.RELEASE_ID
|
|
|
|
|
const artifactPathName = process.env.ARTIFACT_PATHNAME
|
|
|
|
|
const artifactName = process.env.ARTIFACT_NAME
|
|
|
|
|
console.log('Releasing', releaseId, artifactPathName, artifactName)
|
|
|
|
|
|
|
|
|
|
await github.repos.uploadReleaseAsset({
|
|
|
|
|
owner, repo,
|
|
|
|
|
release_id: releaseId,
|
|
|
|
|
name: artifactName,
|
|
|
|
|
data: await fs.readFile(artifactPathName)
|
|
|
|
|
});
|
|
|
|
|
build-push:
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
needs: check
|
|
|
|
|
steps:
|
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
- name: Docker build and push
|
|
|
|
|
uses: halo-sigs/actions/admin-next-docker-build-push@main
|
|
|
|
|
with:
|
|
|
|
|
image-name: admin-dev
|
|
|
|
|
ghcr-token: ${{ secrets.GHCR_TOKEN }}
|
|
|
|
|
dockerhub-user: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
|
dockerhub-token: ${{ secrets.DOCKER_TOKEN }}
|
|
|
|
|
push: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/next' }} # we only push to GHCR if the push is to the next branch
|
|
|
|
|