-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'OCD-4459-test' into development
- Loading branch information
Showing
4 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: deploy files | ||
on: [push] | ||
jobs: | ||
|
||
deploy_website_container: | ||
runs-on: ubuntu-latest | ||
name: Deploy the website container to an environment it can be picked up | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: branch name | ||
run: echo running on branch ${GITHUB_REF##*/} | ||
|
||
- name: docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
# list of Docker images to use as base name for tags | ||
images: | | ||
chpl-website/app | ||
# generate Docker tags based on the following events/attributes | ||
tags: | | ||
type=ref,event=branch | ||
type=raw,latest | ||
- name: set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: build the image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
tags: ${{ steps.meta.outputs.tags }} | ||
outputs: type=docker,dest=/tmp/app.tar | ||
|
||
- name: save the file | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: app | ||
path: /tmp/app.tar | ||
|
||
- name: restore the file | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: app | ||
path: distfiles | ||
|
||
- name: copy file to server | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.HOST }} | ||
username: ${{ secrets.USERNAME }} | ||
key: ${{ secrets.KEY }} | ||
passphrase: ${{ secrets.PASSPHRASE }} | ||
source: distfiles/* | ||
target: ${{ secrets.TARGET }} | ||
|
||
- name: load the image | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.HOST }} | ||
username: ${{ secrets.USERNAME }} | ||
key: ${{ secrets.KEY }} | ||
passphrase: ${{ secrets.PASSPHRASE }} | ||
script: | | ||
echo ${{ secrets.PASSWORD }} | sudo -S docker load --input distfiles/app.tar | ||
echo ${{ secrets.PASSWORD }} | sudo -S docker image ls -a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Container image that runs your code | ||
FROM alpine:3.10 | ||
|
||
# Copies your code file from your action repository to the filesystem path `/` of the container | ||
COPY entrypoint.sh /entrypoint.sh | ||
|
||
# Code file to execute when the docker container starts up (`entrypoint.sh`) | ||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# action.yml | ||
name: 'Hello World' | ||
description: 'Greet someone and record the time' | ||
inputs: | ||
who-to-greet: # id of input | ||
description: 'Who to greet' | ||
required: true | ||
default: 'World' | ||
outputs: | ||
time: # id of output | ||
description: 'The time we greeted you' | ||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile' | ||
args: | ||
- ${{ inputs.who-to-greet }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/sh -l | ||
|
||
echo "Hello $1" | ||
time=$(date) | ||
echo "time=$time" >> $GITHUB_OUTPUT |