diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2ac16f0..ee14493 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,9 +1,5 @@ on: - push: - branches: [master] pull_request: - schedule: - - cron: '30 3 * * 2' name: CI @@ -11,31 +7,7 @@ jobs: test: name: Build website runs-on: ubuntu-latest - if: github.ref != 'refs/heads/master' steps: - uses: actions/checkout@v2 - name: Build Docker image run: docker build --no-cache . - - publish: - name: Publish Docker image - runs-on: ubuntu-latest - if: github.ref == 'refs/heads/master' - steps: - - uses: actions/checkout@v2 - - name: Extract branch name - shell: bash - run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" - id: extract_branch - - name: Build Docker image - run: | - docker build \ - --no-cache \ - -t spaceapi/website:latest \ - -t spaceapi/website:v3 \ - -t spaceapi/website:${{ steps.extract_branch.outputs.branch }} \ - . - - name: Push Docker image - run: | - docker login -u "${{ secrets.DOCKER_USERNAME }}" -p "${{ secrets.DOCKER_PASSWORD }}" && \ - docker push -a spaceapi/website diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..ec1504d --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,26 @@ +on: + push: + branches: [master] + schedule: + - cron: '30 3 * * 2' + +name: Publish + +jobs: + publish: + name: Publish Docker image + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Build Docker image + run: | + docker build \ + --no-cache \ + -t spaceapi/website:latest \ + -t spaceapi/website:v3 \ + -t spaceapi/website:master \ + . + - name: Push Docker image + run: | + docker login -u "${{ secrets.DOCKER_USERNAME }}" -p "${{ secrets.DOCKER_PASSWORD }}" && \ + docker push -a spaceapi/website