Skip to content

Commit

Permalink
Pass secrets to callable workflows.
Browse files Browse the repository at this point in the history
  • Loading branch information
drew2a committed Jun 27, 2022
1 parent f7ca1e7 commit 2e29f73
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 6 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/!main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,30 @@ on:
jobs:
docker:
uses: ./.github/workflows/docker-image.yml
secrets:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}

codacy:
uses: ./.github/workflows/codacy.yml
secrets:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}

coverage:
uses: ./.github/workflows/coverage.yml
with:
python-version: 3.8
secrets:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}

pytest:
uses: ./.github/workflows/pytest.yml
with:
python-version: 3.8

ubuntu:
uses: ./.github/workflows/build_ubuntu.yml
with:
python-version: 3.8
secrets:
SENTRY_URL: ${{ secrets.SENTRY_URL }}
3 changes: 3 additions & 0 deletions .github/workflows/build_ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ on:
default: false
type: boolean
required: false
secrets:
SENTRY_URL:
required: false

workflow_dispatch:
inputs:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/codacy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ name: Codacy Security Scan

on:
workflow_call:

secrets:
CODACY_PROJECT_TOKEN:
required: true
jobs:
analyse:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
default: 3.8
type: string
required: false
secrets:
CODACY_PROJECT_TOKEN:
required: false

jobs:
generate_and_upload:
Expand Down
19 changes: 14 additions & 5 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,32 @@ name: Docker Image CI

on:
workflow_call:

secrets:
DOCKER_USER:
required: true
DOCKER_PASSWORD:
required: true
jobs:

build:

runs-on: ubuntu-latest

steps:
- name: Checkout repository and submodules
uses: actions/checkout@v2

- name: Docker login
env:
DOCKER_USER: ${{secrets.DOCKER_USER}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
run: |
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
- name: Build the Docker image
run: docker build . --file Dockerfile --tag triblercore/triblercore:latest
run: |
docker build . --file Dockerfile --tag triblercore/triblercore:latest
- name: Push to Docker Hub
run: docker push ${{secrets.DOCKER_USER}}/triblercore:latest
env:
DOCKER_USER: ${{secrets.DOCKER_USER}}
run: |
docker push $DOCKER_USER/triblercore:latest

0 comments on commit 2e29f73

Please sign in to comment.