From 709ddc4b2f3267159f451f6c818f2508a715c16f Mon Sep 17 00:00:00 2001 From: Derek Holloway Date: Thu, 3 Jul 2025 00:34:04 +0000 Subject: [PATCH] chatgpt test --- .gitea/workflows/demo.yaml | 53 ++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/.gitea/workflows/demo.yaml b/.gitea/workflows/demo.yaml index 2876994..a18e6d7 100644 --- a/.gitea/workflows/demo.yaml +++ b/.gitea/workflows/demo.yaml @@ -1,25 +1,38 @@ -name: Build-Release +name: Docker Build and Release Upload -on: [push] +on: + push: + tags: + - "v*" jobs: - Build-Release: + build: runs-on: ubuntu-latest steps: - - name: Check out repository code - uses: https://github.com/actions/checkout@v4 - - - name: Setup docker build - uses: https://github.com/docker/setup-buildx-action@v3 - - - name: Build docker image - run: docker build --build-arg BASE_URL=https://mistox.com -t myapp:${GITEA_REF_NAME} . - - - name: Create Tarball of image - run: docker save myapp:${GITEA_REF_NAME} -o myapp:${GITEA_REF_NAME}.tar - - - name: Upload Release Artifact - uses: https://github.com/actions/upload-release-asset@v1 - with: - tag: ${{ gitea.ref_name }} - file: myapp-${{ gitea.ref_name }}.tar \ No newline at end of file + - name: Checkout code + uses: actions/checkout@v3 + + - name: Build Docker image + run: docker build -t myapp:${GITEA_REF_NAME} . + + - name: Save Docker image to tarball + run: docker save myapp:${GITEA_REF_NAME} -o myapp-${GITEA_REF_NAME}.tar + + - name: Create Gitea release (if needed) + run: curl -s -X POST \ + -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \ + -H "Content-Type: application/json" \ + -d "{\"tag_name\": \"${GITEA_REF_NAME}\", \"name\": \"${GITEA_REF_NAME}\"}" \ + https://${GITEA_SERVER}/api/v1/repos/${GITEA_REPOSITORY}/releases || true + + - name: Get release ID + id: get_release + run: RELEASE_JSON=$(curl -s -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \ + https://${GITEA_SERVER}/api/v1/repos/${GITEA_REPOSITORY}/releases/tags/${GITEA_REF_NAME}) + echo "release_id=$(echo $RELEASE_JSON | jq -r .id)" >> $GITEA_OUTPUT + + - name: Upload tarball to Gitea release + run: curl -s -X POST \ + -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \ + -F "attachment=@myapp-${GITEA_REF_NAME}.tar" \ + https://${GITEA_SERVER}/api/v1/repos/${GITEA_REPOSITORY}/releases/${{ steps.get_release.outputs.release_id }}/assets \ No newline at end of file