Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ inputs:
default: false
gh_event:
description: The name of the event that triggered the parent workflow.
outputs:
ghc_img:
description: "Export GHCR.io package resource URL"
value: ${{ steps.ghc_img_id.outputs.ghc_img }}

runs:
using: composite
Expand Down Expand Up @@ -142,3 +146,8 @@ runs:
cache-from: type=gha
cache-to: type=gha,mode=max
provenance: false

- name: Export GHCR.io resource
id: ghc_img_id
shell: bash
run: echo "ghc_img=${{ inputs.image }}:${{ steps.tag_check.outputs.tag }}" >> $GITHUB_OUTPUT
66 changes: 66 additions & 0 deletions deploy/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Deploy
description: "This action is used to deploy"

inputs:
environment:
required: false
description: the github actions environment context
image:
required: true
description: The full gchr image
file:
required: true
description: path to file in repository to update with the image
CONFIG_REPO_RW_APP_ID:
description: The ID of the GithubApp that is used to generate keys that enable one repository to send repository dispatch messages to another.
required: true
CONFIG_REPO_RW_INSTALL_ID:
description: ""
required: false
CONFIG_REPO_FULL_NAME:
description: The github repo of the tanka control repository
required: true
# secrets:
CONFIG_REPO_RW_KEY:
description: The private key used to talk to the GithubAPP with the App ID
required: true

runs:
using: composite
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set environment variables
shell: bash
run: |
if [ -z "${{ inputs.CONFIG_REPO_RW_APP_ID }}" ]
then
echo "CONFIG_REPO_RW_APP_ID=${{ env.CONFIG_REPO_RW_APP_ID }}" >> $GITHUB_ENV
echo "setting CONFIG_REPO_RW_APP_ID to ${{ env.CONFIG_REPO_RW_APP_ID }} from env"
else
echo "CONFIG_REPO_RW_APP_ID=${{ inputs.CONFIG_REPO_RW_APP_ID }}" >> $GITHUB_ENV
echo "setting CONFIG_REPO_RW_APP_ID to ${{ inputs.CONFIG_REPO_RW_APP_ID }} from inputs"
fi
if [ -z "${{ inputs.CONFIG_REPO_FULL_NAME }}" ]
then
echo "CONFIG_REPO_FULL_NAME=${{ env.CONFIG_REPO_FULL_NAME }}" >> $GITHUB_ENV
echo "setting CONFIG_REPO_FULL_NAME to ${{ env.CONFIG_REPO_FULL_NAME }} from env"
else
echo "CONFIG_REPO_FULL_NAME=${{ inputs.CONFIG_REPO_FULL_NAME }}" >> $GITHUB_ENV
echo "setting CONFIG_REPO_FULL_NAME to ${{ inputs.CONFIG_REPO_FULL_NAME }} from inputs"
fi
- name: Generate app token
id: generate_token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ env.CONFIG_REPO_RW_APP_ID }}
private-key: ${{ inputs.CONFIG_REPO_RW_KEY }}
owner: ${{ github.repository_owner }}
- name: Send the message
uses: peter-evans/repository-dispatch@v3
with:
event-type: update-image
token: ${{ steps.generate_token.outputs.token }}
repository: ${{ env.CONFIG_REPO_FULL_NAME }}
client-payload: '{ "subject": "Update ${{ inputs.file }}", "body": "Originating repository is ${{ github.repository }}\nRun ID is ${{ github.run_id }}\nUser is ${{ github.actor }}", "image": "${{ inputs.image }}", "file": "${{ inputs.file }}" }'
48 changes: 48 additions & 0 deletions update-image/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Update Image File
description: Updates the image file in the ht_tanka repository

inputs:
subject:
required: true
description: ''
body:
required: true
description: ''
image:
required: true
description: ''
file:
required: true
description: ''

runs:
using: composite
steps:
- name: Clone latest repository
uses: actions/checkout@v4
- name: dump github event
shell: bash
env:
EVENT: ${{ toJson(github.event) }}
run: echo "$EVENT"
- name: update the config
shell: bash
env:
FILE: ${{ inputs.file }}
IMAGE: ${{ inputs.image }}
run: echo -n $IMAGE > $FILE
- name: cat the files
shell: bash
run: cat ${{ inputs.file }}
- name: Commit and push files new file
shell: bash
env:
SUBJECT: ${{ inputs.subject }}
BODY: ${{ inputs.body }}
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Actions Bot"
git pull
git add -A
git commit -m "$SUBJECT" -m "$BODY"
git push