Skip to content

Commit

Permalink
Adds deploy workflow (#1)
Browse files Browse the repository at this point in the history
* Adds deploy workflow
  • Loading branch information
kimpepper authored Sep 20, 2023
1 parent 9ca2a25 commit 3cc8643
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/actionlint.yml
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
80 changes: 80 additions & 0 deletions .github/workflows/deploy.yml
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 }}

0 comments on commit 3cc8643

Please sign in to comment.