Skip to content

Commit

Permalink
Merge pull request #134 from SpaceApi/fix-ci-trigger
Browse files Browse the repository at this point in the history
Split CI and publish runs into separate workflows
  • Loading branch information
dbrgn authored Apr 12, 2024
2 parents 4ccbfea + 3aa67f0 commit 3aee27b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 28 deletions.
28 changes: 0 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,13 @@
on:
push:
branches: [master]
pull_request:
schedule:
- cron: '30 3 * * 2'

name: CI

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
26 changes: 26 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 3aee27b

Please sign in to comment.