1
0
forked from Leaf/amber-ui
amber-ui-re/.gitea/workflows/build.yaml
2024-09-18 22:45:14 +08:00

57 lines
1.8 KiB
YAML

name: Build
# on:
# push:
# paths:
# - manifest.yaml
on:
push:
paths-ignore:
- 'manifests/**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- id: commit
uses: prompt/actions-commit-hash@v3
- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: 18
- name: Build
run: |
npm config set registry https://registry.npmmirror.com
npm install
npm run build
- name: 'Login to Container Registry'
uses: docker/login-action@v3
with:
registry: leafdev.top
username: ${{ gitea.actor }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: 'Build Inventory Image'
run: |
docker build . -f Dockerfile --tag leafdev.top/leaf/amber-ui:${{ steps.commit.outputs.short }}
docker push leafdev.top/leaf/amber-ui:${{ steps.commit.outputs.short }}
docker tag leafdev.top/leaf/amber-ui:${{ steps.commit.outputs.short }} leafdev.top/leaf/amber-ui:latest
- name: 'Patch Manifest'
uses: fjogeleit/yaml-update-action@main
with:
valueFile: 'manifests/deployment.yaml'
propertyPath: 'spec.template.spec.containers[0].image'
value: 'leafdev.top/leaf/amber-ui:${{ steps.commit.outputs.short }}'
commitChange: false
- name: Push
run: |
git config user.name ${{ gitea.actor }}
git config user.email ${{ gitea.actor }}@users.noreply.leafdev.top
git add manifests/deployment.yaml
git commit -m "Update manifests"
# git push https://${{ secrets.GITEA_TOKEN }}@leafdev.top/${{ gitea.repository }}.git
git push