87 lines
2.4 KiB
YAML
87 lines
2.4 KiB
YAML
name: Release package
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Install dependencies with Proxy
|
|
env:
|
|
http_proxy: "http://host.docker.internal:3142"
|
|
https_proxy: "http://host.docker.internal:3142"
|
|
run: |
|
|
# Kiểm tra proxy có hoạt động không
|
|
echo "Acquire::http::Proxy \"$http_proxy\";" > /etc/apt/apt.conf.d/80proxy
|
|
apt-get update
|
|
apt-get install -y --no-install-recommends --no-install-suggests \
|
|
openjdk-25-jdk-headless docker-cli docker-buildx
|
|
|
|
- name: Setup SSH Key
|
|
run: |
|
|
mkdir -p ~/.ssh
|
|
chmod 700 ~/.ssh
|
|
echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/id_ed25519
|
|
chmod 600 ~/.ssh/id_ed25519
|
|
|
|
ssh-keyscan -t ed25519 vps.demonkernel.io.vn >> ~/.ssh/known_hosts
|
|
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Cache Maven packages
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.m2/repository
|
|
**/target/native-image-cache
|
|
**/target/reports
|
|
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-maven-
|
|
|
|
- name: Log in to Gitea Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: vps.demonkernel.io.vn
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.ACCESS_TOKEN }}
|
|
|
|
- uses: pnpm/action-setup@v3
|
|
with:
|
|
version: latest
|
|
run_install: false
|
|
cache: true
|
|
|
|
- name: Run Semantic Release
|
|
env:
|
|
GITEA_USER: ${{ github.actor }}
|
|
GITEA_TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
|
run: |
|
|
pnpm i
|
|
pnpm release
|
|
pnpm format
|
|
|
|
- name: Commit & Push Changes
|
|
run: |
|
|
if [ -n "$(git status --porcelain)" ]&& [ "${{ github.ref_name }}" = "main" ]; then
|
|
git config --global user.name "gitea-actions"
|
|
git config --global user.email "actions-user@noreply.git.demonkernel.io.vn"
|
|
|
|
REPO_NAME="${{ gitea.repository }}"
|
|
|
|
git remote set-url origin ssh://git@vps.demonkernel.io.vn/${REPO_NAME}.git
|
|
|
|
git rm -r --cached .
|
|
git add .
|
|
git commit -m "chore: release [ci skip]"
|
|
|
|
git push
|
|
fi
|