2025-04-08 08:23:02 +00:00
name : ci
2025-04-08 08:10:23 +00:00
on : push
2025-04-07 10:58:47 +00:00
jobs :
2025-04-08 08:23:02 +00:00
build :
runs-on : ubuntu-22.04
2025-04-07 10:58:47 +00:00
steps :
2025-04-08 09:13:12 +00:00
- name : Repository meta
2025-04-08 08:16:17 +00:00
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"
2025-04-10 09:13:35 +00:00
echo "repository=${repository}"
2025-04-08 09:13:12 +00:00
- name : Docker meta
2025-04-08 08:16:17 +00:00
uses : docker/metadata-action@v5
id : docker
with :
images : ${{ steps.repository.outputs.registry }}/${{ steps.repository.outputs.repository }}
2025-04-08 09:13:12 +00:00
- name : Login to registry
2025-04-07 10:58:47 +00:00
uses : docker/login-action@v3
with :
2025-04-08 08:16:17 +00:00
registry : ${{ steps.repository.outputs.registry }}
username : ${{ secrets.PACKAGES_USER }}
password : ${{ secrets.PACKAGES_TOKEN }}
2025-04-08 09:13:12 +00:00
- name : Set up QEMU
2025-04-08 08:23:02 +00:00
uses : docker/setup-qemu-action@v3
2025-04-08 09:13:12 +00:00
- name : Set up Docker Buildx
2025-04-08 08:23:02 +00:00
uses : docker/setup-buildx-action@v3
with :
buildkitd-flags : '--allow-insecure-entitlement network.host'
driver-opts : network=host
2025-04-08 11:36:34 +00:00
- name : Checkout code
uses : actions/checkout@v4
2025-04-08 10:32:51 +00:00
- name : Lint test
2025-04-08 09:13:12 +00:00
run : |
2025-04-08 09:36:52 +00:00
registry=${{ github.server_url }}
registry=${registry##http*://}
2025-04-08 09:40:02 +00:00
repository="$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')"
2025-04-08 09:51:43 +00:00
fullrepo=https://${registry}/${repository}.git
git init
2025-04-10 09:15:02 +00:00
# git pull ${fullrepo}
2025-04-08 10:25:07 +00:00
npm install @angular/cli
2025-04-08 10:37:29 +00:00
npm run lint
2025-04-08 11:36:34 +00:00
- name : Update version
2025-04-24 12:44:54 +00:00
id : get-version
2025-04-08 11:34:01 +00:00
run : |
2025-04-08 11:40:18 +00:00
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"
2025-04-08 11:34:01 +00:00
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "GitHub Actions Bot"
2025-04-09 13:09:00 +00:00
# git checkout -- package-lock.json package.json
2025-04-10 09:15:02 +00:00
git stash
2025-04-08 11:45:17 +00:00
git pull
2025-04-10 09:15:02 +00:00
git stash pop
2025-04-09 13:09:00 +00:00
jq ".version = \"$new_version\"" package.json > temp.json && mv temp.json package.json
2025-04-24 12:27:04 +00:00
sed -i "s|forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/devfw-cicd/michals-silly-game-frontend:.*|forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/devfw-cicd/michals-silly-game-frontend:$new_version|" k8/deployment.yaml
2025-04-08 11:34:01 +00:00
git add .
2025-04-14 09:41:41 +00:00
git commit -m "Automated update by Forgejo Actions"
2025-04-10 09:13:35 +00:00
git push origin HEAD:${{ github.ref_name }}
2025-04-24 12:44:54 +00:00
echo "tag=$new_version" >> "$GITHUB_OUTPUT"
2025-04-08 09:05:09 +00:00
- name : Build and push
2025-04-08 08:23:02 +00:00
uses : docker/build-push-action@v6
2025-04-07 10:58:47 +00:00
with :
push : true
2025-04-08 08:23:02 +00:00
allow : network.host
network : host
2025-04-15 11:35:40 +00:00
platforms : linux/amd64
2025-04-24 12:44:54 +00:00
tags : ${{ steps.repository.outputs.registry }}/${{ steps.repository.outputs.repository }}:${{ steps.get-version.outputs.tag }}