From ff3b2765a7afc8ac4059886539f8c79623abb435 Mon Sep 17 00:00:00 2001 From: Carl Pearson Date: Fri, 29 Aug 2025 09:15:54 -0600 Subject: [PATCH] ci: gitea --- .gitea/workflows/build-deploy.yml | 53 +++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .gitea/workflows/build-deploy.yml diff --git a/.gitea/workflows/build-deploy.yml b/.gitea/workflows/build-deploy.yml new file mode 100644 index 0000000..6dca8fc --- /dev/null +++ b/.gitea/workflows/build-deploy.yml @@ -0,0 +1,53 @@ +name: Build and Deploy ytdlp-site + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +env: + SLUG: git.carlpearson.net/cwpearson/ytdlp-site + TZ: America/Denver + +jobs: + build-deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Print environment info + run: | + echo "Job ID: ${{ github.run_id }}" + echo "Job URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + echo "Build Submitter: ${{ github.actor }}" + echo "Build Reason: ${{ github.event_name }}" + echo "Git Ref: ${{ github.ref }}" + + - name: Setup environment + run: | + echo "DATE=$(date +"%Y%m%d_%H%M")" >> $GITHUB_ENV + echo "GIT_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV + + - name: Install prerequisites + run: | + bash .ci/debian_setup_docker.sh + + - name: Build Docker image + run: | + docker build . \ + --file Dockerfile \ + --build-arg GIT_SHA=${{ env.GIT_SHA }} \ + --tag ${{ env.SLUG }}:${{ env.DATE }} \ + --tag ${{ env.SLUG }}:latest + + - name: Deploy to Container Registry + if: github.ref == 'refs/heads/master' && github.event_name == 'push' + run: | + echo "${{ secrets.GHCR_TOKEN }}" | docker login git.carlpearson.net -u cwpearson --password-stdin + docker push ${{ env.SLUG }}:latest + docker push ${{ env.SLUG }}:${{ env.DATE }}