Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split CI and publish runs into separate workflows #134

Merged
merged 4 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading