Fix CI workflow to use github context variables.
The ChristopherHX runner only supports github.* expressions, not gitea.*. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -20,16 +20,15 @@ jobs:
|
|||||||
- name: Image tags
|
- name: Image tags
|
||||||
id: meta
|
id: meta
|
||||||
run: |
|
run: |
|
||||||
short_sha="${GITEA_SHA:-${GITHUB_SHA}}"
|
short_sha="${GITHUB_SHA:0:7}"
|
||||||
short_sha="${short_sha:0:7}"
|
|
||||||
echo "short_sha=${short_sha}" >> "$GITHUB_OUTPUT"
|
echo "short_sha=${short_sha}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
{
|
{
|
||||||
echo "tags<<EOF"
|
echo "tags<<EOF"
|
||||||
echo "${IMAGE}:latest"
|
echo "${IMAGE}:latest"
|
||||||
echo "${IMAGE}:sha-${short_sha}"
|
echo "${IMAGE}:sha-${short_sha}"
|
||||||
if [ "${GITEA_REF_TYPE:-${GITHUB_REF_TYPE}}" = "tag" ]; then
|
if [ "${GITHUB_REF_TYPE}" = "tag" ]; then
|
||||||
ref_name="${GITEA_REF_NAME:-${GITHUB_REF_NAME}}"
|
ref_name="${GITHUB_REF_NAME}"
|
||||||
echo "${IMAGE}:${ref_name}"
|
echo "${IMAGE}:${ref_name}"
|
||||||
echo "${IMAGE}:${ref_name#v}"
|
echo "${IMAGE}:${ref_name#v}"
|
||||||
fi
|
fi
|
||||||
@@ -37,11 +36,8 @@ jobs:
|
|||||||
} >> "$GITHUB_OUTPUT"
|
} >> "$GITHUB_OUTPUT"
|
||||||
env:
|
env:
|
||||||
IMAGE: ${{ env.IMAGE }}
|
IMAGE: ${{ env.IMAGE }}
|
||||||
GITEA_SHA: ${{ gitea.sha }}
|
|
||||||
GITHUB_SHA: ${{ github.sha }}
|
GITHUB_SHA: ${{ github.sha }}
|
||||||
GITEA_REF_TYPE: ${{ gitea.ref_type }}
|
|
||||||
GITHUB_REF_TYPE: ${{ github.ref_type }}
|
GITHUB_REF_TYPE: ${{ github.ref_type }}
|
||||||
GITEA_REF_NAME: ${{ gitea.ref_name }}
|
|
||||||
GITHUB_REF_NAME: ${{ github.ref_name }}
|
GITHUB_REF_NAME: ${{ github.ref_name }}
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
@@ -51,7 +47,7 @@ jobs:
|
|||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: ${{ env.REGISTRY }}
|
registry: ${{ env.REGISTRY }}
|
||||||
username: ${{ gitea.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
@@ -63,7 +59,7 @@ jobs:
|
|||||||
|
|
||||||
release:
|
release:
|
||||||
needs: build-and-push
|
needs: build-and-push
|
||||||
if: gitea.ref_type == 'tag' || github.ref_type == 'tag'
|
if: github.ref_type == 'tag'
|
||||||
runs-on: self-hosted
|
runs-on: self-hosted
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -75,18 +71,18 @@ jobs:
|
|||||||
NODE_OPTIONS: "--experimental-fetch"
|
NODE_OPTIONS: "--experimental-fetch"
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.REGISTRY_TOKEN }}
|
token: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
tag_name: ${{ gitea.ref_name }}
|
tag_name: ${{ github.ref_name }}
|
||||||
name: Conflict Checker ${{ gitea.ref_name }}
|
name: Conflict Checker ${{ github.ref_name }}
|
||||||
body: |
|
body: |
|
||||||
## Docker
|
## Docker
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker login gitea.scoutitsystems.com
|
docker login gitea.scoutitsystems.com
|
||||||
docker pull gitea.scoutitsystems.com/woogi/conflict-checker:${{ gitea.ref_name }}
|
docker pull gitea.scoutitsystems.com/woogi/conflict-checker:${{ github.ref_name }}
|
||||||
```
|
```
|
||||||
|
|
||||||
Deploy on a host (with `docker-compose.prod.yml` and `backend/.env`):
|
Deploy on a host (with `docker-compose.prod.yml` and `backend/.env`):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
IMAGE_TAG=${{ gitea.ref_name }} docker compose -f docker-compose.prod.yml up -d
|
IMAGE_TAG=${{ github.ref_name }} docker compose -f docker-compose.prod.yml up -d
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user