This commit is contained in:
53
.gitea/workflows/build-deploy.yml
Normal file
53
.gitea/workflows/build-deploy.yml
Normal file
@@ -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 }}
|
Reference in New Issue
Block a user