-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adds deploy workflow
- Loading branch information
Showing
2 changed files
with
102 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,22 @@ | ||
name: actionlint | ||
on: | ||
pull_request: | ||
branches: [ main ] | ||
push: | ||
branches: [ main ] | ||
|
||
jobs: | ||
run-actionlint: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
show-progress: false | ||
- name: actionlint | ||
uses: raven-actions/actionlint@v1 | ||
with: | ||
shellcheck: false | ||
pyflakes: false |
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,80 @@ | ||
name: Skpr Deploy | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
env: | ||
type: string | ||
required: true | ||
description: The Skpr environment to deploy to. | ||
package: | ||
default: true | ||
type: boolean | ||
description: Whether this deployment needs to be packaged. | ||
version: | ||
type: string | ||
description: The version to deploy | ||
version_from_env: | ||
type: string | ||
description: Get the version to deploy from the environment. | ||
post_deploy: | ||
default: make deploy | ||
type: string | ||
description: The post deploy commands to run on the environment. | ||
secrets: | ||
skpr_username: | ||
required: true | ||
skpr_password: | ||
required: true | ||
|
||
env: | ||
SKPR_USERNAME: ${{ secrets.SKPR_USERNAME }} | ||
SKPR_PASSWORD: ${{ secrets.SKPR_PASSWORD }} | ||
GH_TOKEN: ${{ github.token }} | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: ${{ inputs.env }} | ||
url: ${{ steps.skpr-info.outputs.url }} | ||
concurrency: ${{ inputs.env }} | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
show-progress: false | ||
- name: Install Skpr CLI | ||
run: | | ||
gh release download --repo skpr/cli --pattern skpr_*_linux_amd64.deb -O skpr-cli.deb | ||
sudo dpkg -i skpr-cli.deb | ||
- name: Get version | ||
id: version | ||
run: | | ||
if [ -n "${{ inputs.version }}" ]; then | ||
version=${{ inputs.version }} | ||
echo "::notice:: Using explicit version $version" | ||
elif [ -n "${{ inputs.version_from_env }}" ]; then | ||
version=$(skpr info ${{ inputs.version_from_env }} | jq -r ".Version") | ||
echo "::notice:: Using version $version from ${{ inputs.version_from_env }} env" | ||
else | ||
version=$(git describe --tags --always) | ||
echo "::notice:: Using version $version from git describe" | ||
fi | ||
echo "version=$version" >> $GITHUB_OUTPUT | ||
- name: Info | ||
id: skpr-info | ||
shell: bash | ||
run: | | ||
domain=$(skpr info ${{ inputs.env }} | jq -r ".Ingress.Domain") | ||
url=https://$domain | ||
echo "url=$url" >> $GITHUB_OUTPUT | ||
- name: Package | ||
if: inputs.package | ||
run: skpr package ${{ steps.version.outputs.version }} | ||
- name: Deploy | ||
run: skpr deploy ${{ inputs.env }} ${{ steps.version.outputs.version }} | ||
- name: Post-deploy | ||
run: skpr exec ${{ inputs.env }} ${{ inputs.post_deploy }} | ||
|