clapp install before publish #7
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Push | |
on: | |
push: | |
env: | |
REGISTRY: ghcr.io | |
DB_SHARD_1_INTERNAL_HOST: clapp-db-shard-1 | |
DB_SHARD_1_INTERNAL_PORT: 3306 | |
DB_SHARD_2_INTERNAL_HOST: clapp-db-shard-2 | |
DB_SHARD_2_INTERNAL_PORT: 3306 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/clusterlean/ark:main | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: robinraju/[email protected] | |
with: | |
repository: "clusterlean/clapp" | |
latest: true | |
fileName: "clapp" | |
token: ${{ secrets.ADMIN_GITHUB_TOKEN }} | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
registry-url: 'https://npm.pkg.github.com' | |
- name: Clapp init | |
env: | |
DOCKER_NETWORK_NAME: ${{ job.container.network }} | |
run: | | |
docker pull mysql:8.0.33 | |
docker pull redis:7.0.11 | |
docker pull ghcr.io/clusterlean/ark:main | |
chmod +x ./clapp | |
./clapp init | |
docker ps | |
- name: Build and Test | |
env: | |
REDIS_NATMAP_DISABLED: true | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
npm ci | |
npm run fmt:check | |
npm run lint | |
npm run build | |
npm run test | |
./clapp migrate down | |
tar -czvf node_modules.tar.gz node_modules | |
tar -czvf build.tar.gz build | |
tar -czvf dist.tar.gz dist | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: | | |
build.tar.gz | |
dist.tar.gz | |
node_modules.tar.gz | |
retention-days: 1 | |
- run: ./clapp deinit -v | |
# Push job is separated due to higher permissions | |
push: | |
runs-on: ubuntu-latest | |
needs: build | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
- name: Extract build job artifcat | |
run: | | |
tar -xzvf artifact/build.tar.gz | |
tar -xzvf artifact/node_modules.tar.gz | |
tar -xzvf artifact/dist.tar.gz | |
- uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ github.repository }} | |
- uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |