diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index ea6db9d..dc2864b 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -12,5 +12,14 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - name: Set Environment + run: | + echo "SLUG=ghcr.io/cwpearson/ytdlp-site" >> $GITHUB_ENV + echo "DATE=$(date +"%Y%m%d_%H%M")" >> $GITHUB_ENV - name: Build the Docker image - run: docker build . --file Dockerfile --tag server:$(date +%Y%m%d_%H%M) + run: docker build . --file Dockerfile --tag "$SLUG:$DATE" --tag "$SLUG:latest" + - name: Publish to GHCR + run: | + echo '${{secrets.GHCR_TOKEN}}' | docker login ghcr.io -u cwpearson --password-stdin + docker push "$SLUG:latest" + docker push "$SLUG:$DATE" \ No newline at end of file diff --git a/README.md b/README.md index b423811..2c8b33b 100644 --- a/README.md +++ b/README.md @@ -32,4 +32,12 @@ docker run --rm -it \ --env YTDLP_SITE_ADMIN_INITIAL_PASSWORD=abc123 \ -v $(realpath downloads):/downloads \ server -``` \ No newline at end of file +``` + +## GHCR Deploy + +Build and push this container to ghcr + +* Create a "personal access token (classic)" with write:packages + * account > settings > developer settings > personal access tokens > tokens (classic) > generate new token (classic) +* Put that personal access token as the repository actions secret `GHCR_TOKEN`.