46 lines
1.6 KiB
YAML
46 lines
1.6 KiB
YAML
# name of the workflow.
|
|
# this is optional.
|
|
name: Cloud Actions
|
|
|
|
# events that will trigger this workflow.
|
|
# here, we only have "pull_request", so the workflow will run
|
|
# whenever we create a pull request.
|
|
# other examples: [push] and [pull_request, push]
|
|
on:
|
|
pull_request:
|
|
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
# each workflow must have at least one job.
|
|
# jobs run in parallel by default (we can change that).
|
|
# each job groups together a series of steps to accomplish a purpose.
|
|
jobs:
|
|
Dockerhub:
|
|
runs-on: ubuntu-latest
|
|
# if: ${{ github.ref == 'refs/heads/master' || github.event.pull_request.merged == true }} # Runs if it's a push to 'main' or a merged PR to 'main'
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Login to Dockerhub # log into docker hub
|
|
uses: docker/login-action@v2
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }} # Using secret for Docker username
|
|
password: ${{ secrets.DOCKER_PASSWORD }} # Using secret for Docker password
|
|
id: docker-login
|
|
|
|
- name: build container image # build the container
|
|
run: docker compose build --no-cache
|
|
id: docker-build
|
|
|
|
- name: Upload to Dockerhub
|
|
run: docker push darkicewolf50/darkicewolf50cloud:latest
|
|
if: ${{ steps.docker-login.outcome == 'success' && steps.docker-build.outcome == 'success' }}
|
|
|
|
- name: Upload with Git SHA tag
|
|
run: |
|
|
docker tag darkicewolf50/darkicewolf50cloud:latest darkicewolf50/darkicewolf50cloud:${{ github.sha }}
|
|
docker push darkicewolf50/darkicewolf50cloud:${{ github.sha }}
|