Publish to github container registry #14
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
name: Push built docker image straight over the wire | |
on: | |
push: | |
schedule: | |
- cron: '00 00 * * 1' | |
jobs: | |
docker_catapult: | |
runs-on: "ubuntu-22.04" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Environment | |
run: | | |
echo "REPO_NAME=${GITHUB_REPOSITORY#$GITHUB_REPOSITORY_OWNER/}" >> $GITHUB_ENV | |
echo "token = \"${{secrets.TOKEN}}\"" >> secret.py | |
- name: Build Docker Image | |
run: | | |
docker image build \ | |
--label owner="$GITHUB_REPOSITORY_OWNER" \ | |
-t "$REPO_NAME" . | |
- name: Save Docker Image | |
run: docker save "$REPO_NAME" -o "$REPO_NAME".tar | |
- name: scp ssh pipelines | |
uses: cross-the-world/ssh-scp-ssh-pipelines@latest | |
with: | |
host: hsnipe.moe | |
user: root | |
key: ${{secrets.SSH_KEY}} | |
scp: | | |
"./$REPO_NAME.tar" => /home/ | |
last_ssh: | | |
docker image load --input "/home/$REPO_NAME.tar" | |
docker stop -t 2 "$REPO_NAME" || true | |
docker run -d --name "$REPO_NAME" --rm "$REPO_NAME" |