Skip to content

Commit

Permalink
Modernize docker build and secrets checks
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed Aug 14, 2024
1 parent 28e81ee commit ad85000
Showing 1 changed file with 26 additions and 15 deletions.
41 changes: 26 additions & 15 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,34 @@ on:
- deploy

jobs:
deploy:
name: Build and deploy

check-secrets:
runs-on: ubuntu-latest
outputs:
HAS_SECRETS: ${{ steps.check.outputs.HAS_SECRETS }}
steps:

- name: Install Docker
run: |
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
- name: Build Docker image
- id: check
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
if: ${{ env.DOCKERHUB_USERNAME && env.DOCKERHUB_PASSWORD }}
run: |
echo "$DOCKERHUB_PASSWORD" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
docker build -t kspckan/mod-installer .
docker tag kspckan/mod-installer kspckan/mod-installer:latest
docker push kspckan/mod-installer:latest
run: |-
echo "::set-output name=HAS_SECRETS::${{ env.DOCKERHUB_USERNAME != '' && env.DOCKERHUB_PASSWORD != '' }}"
deploy:
name: Build and deploy
needs: check-secrets
if: needs.check-secrets.outputs.HAS_SECRETS
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build ModInstaller image
uses: docker/build-push-action@v5
with:
tags: kspckan/mod-installer
outputs: type=registry

0 comments on commit ad85000

Please sign in to comment.