diff --git a/.github/workflows/default.yml b/.github/workflows/default.yml index 3134af8..9c5b279 100644 --- a/.github/workflows/default.yml +++ b/.github/workflows/default.yml @@ -1,4 +1,4 @@ -name: Deploy +name: CI/CD on: push: @@ -10,6 +10,8 @@ jobs: build: runs-on: ubuntu-latest steps: + - name: Checkout + uses: actions/checkout@v1 - name: Create a new build run: docker build -t publisher:latest -f ./dockerfiles/Deploy.Dockerfile . deploy: @@ -19,13 +21,13 @@ jobs: steps: - name: Deploy to gh-pages branch env: - GITHUB_PAT: ${{ secrets.GITHUB_PAT }} + REPOSITORY_TOKEN: ${{ secrets.REPOSITORY_TOKEN }} PUBLISHER_NAME: ${{ secrets.PUBLISHER_NAME }} PUBLISHER_EMAIL: ${{ secrets.PUBLISHER_EMAIL }} run: | docker run \ --rm \ - -e GITHUB_PAT="$env:GITHUB_PAT" \ + -e REPOSITORY_TOKEN="$env:REPOSITORY_TOKEN" \ -e PUBLISHER_NAME="$env:PUBLISHER_NAME" \ -e PUBLISHER_EMAIL="$env:PUBLISHER_EMAIL" \ publisher:latest diff --git a/dockerfiles/Deploy.Dockerfile b/dockerfiles/Deploy.Dockerfile index d36a926..154b8a1 100644 --- a/dockerfiles/Deploy.Dockerfile +++ b/dockerfiles/Deploy.Dockerfile @@ -1,4 +1,4 @@ -ARG GITHUB_PAT +ARG REPOSITORY_TOKEN FROM mcr.microsoft.com/powershell:latest AS prebuild WORKDIR /src @@ -12,8 +12,8 @@ RUN yarn RUN yarn build FROM mcr.microsoft.com/powershell:latest AS final -ARG GITHUB_PAT -ENV GITHUB_PAT ${GITHUB_PAT} +ARG REPOSITORY_TOKEN +ENV REPOSITORY_TOKEN ${REPOSITORY_TOKEN} WORKDIR /src RUN apt-get update RUN apt install -y git diff --git a/scripts/deploy.ps1 b/scripts/deploy.ps1 index 34c8bfb..572fe93 100644 --- a/scripts/deploy.ps1 +++ b/scripts/deploy.ps1 @@ -21,7 +21,7 @@ git commit -m "auto-deployment"; try { # Force push to gh-pages Write-Host "Pushing to gh-pages branch"; - git push -uqf $env:GITHUB_PAT HEAD:gh-pages 2>&1 | Out-Null; + git push -uqf $env:REPOSITORY_TOKEN HEAD:gh-pages 2>&1 | Out-Null; } catch { Write-Error "Push failed";