abd879ab66
The Gitea Actions workflow used ${{ github.sha }} which is GitHub Actions
syntax. In Gitea Actions the correct context variable is ${{ gitea.sha }}.
This caused the image tag SHA component to be empty.
Closes leeworks-agents/gitea-mobile#20
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
49 lines
1.3 KiB
YAML
49 lines
1.3 KiB
YAML
name: Build and Push
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.22'
|
|
|
|
- name: Run tests
|
|
run: go test ./...
|
|
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
needs: test
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set image tag
|
|
id: tag
|
|
run: |
|
|
TIMESTAMP=$(date +%Y%m%d%H%M%S)
|
|
SHA=$(echo ${{ gitea.sha }} | cut -c1-7)
|
|
echo "tag=${TIMESTAMP}-${SHA}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Build Docker image
|
|
run: |
|
|
docker build -t gitea.leeworks.dev/0xwheatyz/gitea-mobile:${{ steps.tag.outputs.tag }} .
|
|
docker tag gitea.leeworks.dev/0xwheatyz/gitea-mobile:${{ steps.tag.outputs.tag }} \
|
|
gitea.leeworks.dev/0xwheatyz/gitea-mobile:latest
|
|
|
|
- name: Login to Gitea registry
|
|
run: |
|
|
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login gitea.leeworks.dev \
|
|
-u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin
|
|
|
|
- name: Push image
|
|
run: |
|
|
docker push gitea.leeworks.dev/0xwheatyz/gitea-mobile:${{ steps.tag.outputs.tag }}
|
|
docker push gitea.leeworks.dev/0xwheatyz/gitea-mobile:latest
|