Skip to content

Commit

Permalink
feat(terraform): Update hw-observer's release.yaml and promote.yaml w…
Browse files Browse the repository at this point in the history
…ith terraform
  • Loading branch information
jneo8 committed May 31, 2024
1 parent 5619e53 commit 83aef57
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/terraform-apply.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
fail-fast: false
matrix:
repository:
- hardware-observer-operator_main
- charmed-openstack-upgrader_main
# The snapcraft channel for 3.x is not ready
# - charmed-openstack-upgrader_3.x
Expand Down
21 changes: 21 additions & 0 deletions terraform-plans/configs/hardware-observer-operator_main.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
repository = "hardware-observer-operator"
branch = "main"
workflow_files = {
codeowners = {
source = "./files/github/CODEOWNERS"
destination = ".github/CODEOWNERS"
variables = {}
}
promote = {
source = "./files/github/charm_promote.yaml"
destination = ".github/workflows/promote.yaml"
variables = {}
}
release = {
source = "./files/github/charm_release.yaml"
destination = ".github/workflows/release.yaml"
variables = {
branch = "main"
}
}
}
25 changes: 25 additions & 0 deletions terraform-plans/files/github/charm_promote.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Promote charm to other tracks and channels

on:
workflow_dispatch:
inputs:
destination-channel:
description: 'Destination Channel, e.g. latest/candidate'
required: true
origin-channel:
description: 'Origin Channel, e.g. latest/edge'
required: true

jobs:
promote-charm:
name: Promote charm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Release charm to channel
uses: canonical/charming-actions/[email protected]
with:
credentials: $${{ secrets.CHARMHUB_TOKEN }}
github-token: $${{ secrets.GITHUB_TOKEN }}
destination-channel: $${{ github.event.inputs.destination-channel }}
origin-channel: $${{ github.event.inputs.origin-channel }}
29 changes: 29 additions & 0 deletions terraform-plans/files/github/charm_release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Release to Edge

on:
push:
branches: [ ${vars.branch} ]
release:
types: [ published ]

jobs:
check:
uses: ./.github/workflows/check.yaml
secrets: inherit

release:
needs: check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Initialize lxd # This should dropped once it's implemented on charming-actions itself. https://github.com/canonical/charming-actions/issues/140
uses: canonical/[email protected]
- name: Upload charm to charmhub
uses: canonical/charming-actions/[email protected]
with:
credentials: "$${{ secrets.CHARMHUB_TOKEN }}"
github-token: "$${{ secrets.GITHUB_TOKEN }}"
channel: "latest/edge"
# Note(rgildein): Right now we are not using destructive-mode, since our charmcraft.yaml is designed with a single build-on and the ability to run-on multiple bases. Running with destructive-mode would require aligning the base defined in this job with the one defined in charmcraft.yaml (build-on).
destructive-mode: false

0 comments on commit 83aef57

Please sign in to comment.