75 lines
2.7 KiB
YAML
75 lines
2.7 KiB
YAML
name: ci
|
|
|
|
on: push
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- name: Repository meta
|
|
id: repository
|
|
run: |
|
|
registry=${{ github.server_url }}
|
|
registry=${registry##http*://}
|
|
echo "registry=${registry}" >> "$GITHUB_OUTPUT"
|
|
echo "registry=${registry}"
|
|
repository="$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')"
|
|
echo "repository=${repository}" >> "$GITHUB_OUTPUT"
|
|
echo "repository=${repository}"
|
|
- name: Docker meta
|
|
uses: docker/metadata-action@v5
|
|
id: docker
|
|
with:
|
|
images: ${{ steps.repository.outputs.registry }}/${{ steps.repository.outputs.repository }}
|
|
- name: Login to registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ steps.repository.outputs.registry }}
|
|
username: ${{ secrets.PACKAGES_USER }}
|
|
password: ${{ secrets.PACKAGES_TOKEN }}
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
with:
|
|
buildkitd-flags: '--allow-insecure-entitlement network.host'
|
|
driver-opts: network=host
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
- name: Lint test
|
|
run: |
|
|
registry=${{ github.server_url }}
|
|
registry=${registry##http*://}
|
|
repository="$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')"
|
|
fullrepo=https://${registry}/${repository}.git
|
|
git init
|
|
# git pull ${fullrepo}
|
|
npm install @angular/cli
|
|
npm run lint
|
|
- name: Update version
|
|
run: |
|
|
set -e
|
|
current_version=$(jq -r '.version' package.json)
|
|
echo "Current version: $current_version"
|
|
IFS='.' read -r major minor patch <<< "$current_version"
|
|
new_patch=$((patch + 1))
|
|
new_version="$major.$minor.$new_patch"
|
|
echo "New version: $new_version"
|
|
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
|
git config --local user.name "GitHub Actions Bot"
|
|
# git checkout -- package-lock.json package.json
|
|
git stash
|
|
git pull
|
|
git stash pop
|
|
jq ".version = \"$new_version\"" package.json > temp.json && mv temp.json package.json
|
|
git add .
|
|
git commit -m "Automated update by Forgejo Actions"
|
|
git push origin HEAD:${{ github.ref_name }}
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
push: true
|
|
allow: network.host
|
|
network: host
|
|
platforms: linux/arm64
|
|
tags: ${{ steps.docker.outputs.tags }}
|