update workflow

This commit is contained in:
Matteias Collet 2020-06-29 03:25:20 +02:00
parent 4edec7c4b7
commit 2092a008f4
3 changed files with 9 additions and 7 deletions

View file

@ -1,4 +1,4 @@
name: Deploy name: CI/CD
on: on:
push: push:
@ -10,6 +10,8 @@ jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout
uses: actions/checkout@v1
- name: Create a new build - name: Create a new build
run: docker build -t publisher:latest -f ./dockerfiles/Deploy.Dockerfile . run: docker build -t publisher:latest -f ./dockerfiles/Deploy.Dockerfile .
deploy: deploy:
@ -19,13 +21,13 @@ jobs:
steps: steps:
- name: Deploy to gh-pages branch - name: Deploy to gh-pages branch
env: env:
GITHUB_PAT: ${{ secrets.GITHUB_PAT }} REPOSITORY_TOKEN: ${{ secrets.REPOSITORY_TOKEN }}
PUBLISHER_NAME: ${{ secrets.PUBLISHER_NAME }} PUBLISHER_NAME: ${{ secrets.PUBLISHER_NAME }}
PUBLISHER_EMAIL: ${{ secrets.PUBLISHER_EMAIL }} PUBLISHER_EMAIL: ${{ secrets.PUBLISHER_EMAIL }}
run: | run: |
docker run \ docker run \
--rm \ --rm \
-e GITHUB_PAT="$env:GITHUB_PAT" \ -e REPOSITORY_TOKEN="$env:REPOSITORY_TOKEN" \
-e PUBLISHER_NAME="$env:PUBLISHER_NAME" \ -e PUBLISHER_NAME="$env:PUBLISHER_NAME" \
-e PUBLISHER_EMAIL="$env:PUBLISHER_EMAIL" \ -e PUBLISHER_EMAIL="$env:PUBLISHER_EMAIL" \
publisher:latest publisher:latest

View file

@ -1,4 +1,4 @@
ARG GITHUB_PAT ARG REPOSITORY_TOKEN
FROM mcr.microsoft.com/powershell:latest AS prebuild FROM mcr.microsoft.com/powershell:latest AS prebuild
WORKDIR /src WORKDIR /src
@ -12,8 +12,8 @@ RUN yarn
RUN yarn build RUN yarn build
FROM mcr.microsoft.com/powershell:latest AS final FROM mcr.microsoft.com/powershell:latest AS final
ARG GITHUB_PAT ARG REPOSITORY_TOKEN
ENV GITHUB_PAT ${GITHUB_PAT} ENV REPOSITORY_TOKEN ${REPOSITORY_TOKEN}
WORKDIR /src WORKDIR /src
RUN apt-get update RUN apt-get update
RUN apt install -y git RUN apt install -y git

View file

@ -21,7 +21,7 @@ git commit -m "auto-deployment";
try { try {
# Force push to gh-pages # Force push to gh-pages
Write-Host "Pushing to gh-pages branch"; 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 { catch {
Write-Error "Push failed"; Write-Error "Push failed";