forked from NicholasCote/nbviz-to-container
-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (36 loc) · 1.65 KB
/
self-hosted-test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# This workflow builds container images and pushes them to Docker Hub
# Set the workflow name
name: Workshop self-hosted Build & Push
# Define the trigger that starts the action
# For this workflow the trigger is on a push that changes anything in the August-08-24 directory in the August-08-2024/ directory on the main branch
on:
push:
paths:
- August-08-2024/**
branches:
- main
# Define the actions that are going to take place as part of this workflow
jobs:
# Name the job(s)
build-push-sh-runner:
# Define where the job should run
# In this case it will be run on the self-hosted runner image
runs-on: self-hosted
# Set the steps to take in order
steps:
# Step 1 is to checkout the github repo used to build the container image
- name: Check out the repo
uses: actions/checkout@v4
# Get the date to apply to image tag
- name: Get current date
id: date
run: echo "date=$(date +'%Y-%m-%d.%H.%M')" >> $GITHUB_OUTPUT
# Use podman to build the image and tag it with the current date
- name: Build and push image
run: podman build -f August-08-2024/Containerfile -t docker.io/hsoh/workshop-webapp:${{ steps.date.outputs.date }} August-08-2024/.
# Login to Docker Hub with the repository secrets defined earlier in the workshop
- name: Login to Docker Hub
run: podman login docker.io -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }}
# Push the image to Docker Hub
- name: Push image to Docker Hub
run: podman push docker.io/hsoh/workshop-webapp:${{ steps.date.outputs.date }}