Taobin-Recipe-Manager/.gitea/workflows/build_client.yml
2024-09-10 08:27:15 +07:00

108 lines
No EOL
4.3 KiB
YAML

name: Web Client Package
on:
push:
tags:
- "v*"
- "!v*-dev"
jobs:
build_binary:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install Angular CLI
run: npm install -g @angular/cli
- name: Install dependencies
run: |
pwd
cd client
ls
npm install
- name: Build Angular project
run: |
pwd
cd client
ls
ng build ${{ inputs.project_name }}
- name: Zip files
uses: vimtor/action-zip@v1.2
with:
files: client/dist/client/
dest: client/dist/client.zip
- name: Create Release
uses: akkuman/gitea-release-action@v1
with:
md5sum: true
files: |-
client/dist/client.zip
build_server_binary:
env:
ACTIONS_RUNTIME_TOKEN: ${{ secrets.ENV_GITEA_TOKEN }}
GITHUB_TOKEN: ${{ secrets.ENV_GITEA_TOKEN }}
runs-on: ubuntu-latest
permissions:
packages: write
activitypub: write
admin: write
repository: write
user: write
steps:
- uses: actions/checkout@v4
- run: git fetch --unshallow --quiet --tags --force
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- uses: docker/metadata-action@v5
id: meta
with:
images: pakin/taobin_recipe_manager
tags: |
type=semver,pattern={{version}}
type=semver,pattern=latest
type=semver,pattern={{major}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}.{{minor}}.{{patch}}
- uses: docker/login-action@v3
with:
registry: pakin-inspiron-15-3530.tail360bd.ts.net
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.ENV_GITEA_TOKEN }}
- name: Get JQ
run: |
apt-get update
apt-get install jq
- name: Download env
run: |
pwd
curl -H 'accept: application/json' -H 'authorization: Basic cGFraW46YWRtaW4xMjM=' "$(curl -X 'GET' \
'https://pakin-inspiron-15-3530.tail360bd.ts.net/api/v1/repos/pakin/taobin_recipe_manager/releases/19/assets/73' \
-H 'accept: application/json' \
-H 'authorization: Basic cGFraW46YWRtaW4xMjM=' | jq -r '.browser_download_url' | sed -e 's/http/https/g' | sed -e 's/100.64.210.13\:3001/pakin-inspiron-15-3530.tail360bd.ts.net/g')" | jq -r '.body.env' | base64 -d > ./server/app.env
cat ./server/app.env
- name: Download secret
run: |
pwd
curl -H 'accept: application/json' -H 'authorization: Basic cGFraW46YWRtaW4xMjM=' "$(curl -X 'GET' \
'https://pakin-inspiron-15-3530.tail360bd.ts.net/api/v1/repos/pakin/taobin_recipe_manager/releases/19/assets/73' \
-H 'accept: application/json' \
-H 'authorization: Basic cGFraW46YWRtaW4xMjM=' | jq -r '.browser_download_url' | sed -e 's/http/https/g' | sed -e 's/100.64.210.13\:3001/pakin-inspiron-15-3530.tail360bd.ts.net/g')" | jq -r '.body.secret' | base64 -d > ./server/client_secret.json
cat ./server/client_secret.json
- name: Run Golang tests
run: |
cd server
go test -v ./...
- name: Build and push
run: |
pwd
cd server
echo "get ref name:${{ github.ref_name }}."
/usr/bin/docker build -t pakin-inspiron-15-3530.tail360bd.ts.net/pakin/taobin_recipe_manager:latest -t pakin-inspiron-15-3530.tail360bd.ts.net/pakin/taobin_recipe_manager:${{ github.ref_name }} .
/usr/bin/docker push pakin-inspiron-15-3530.tail360bd.ts.net/pakin/taobin_recipe_manager:latest
/usr/bin/docker push pakin-inspiron-15-3530.tail360bd.ts.net/pakin/taobin_recipe_manager:${{ github.ref_name }}
# - name: Import image with containerd
# run: |
# sudo ctr i import --base-name pakin-inspiron-15-3530.tail360bd.ts.net/pakin/tb-mng-server-app --digests --all-platforms /tmp/image.tar
# - name: Push image to registry
# run: |
# sudo ctr --debug i push --user "${{ secrets.DOCKER_USERNAME }}:${{ secrets.DOCKER_PASSWORD }}" --digests pakin-inspiron-15-3530.tail360bd.ts.net/pakin/tb-mng-server-app:latest