Skip to content

Commit

Permalink
Add new release and promote workflow
Browse files Browse the repository at this point in the history
Using official actions directly.
  • Loading branch information
rgildein committed May 3, 2024
1 parent b6bafcc commit c391e3d
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 14 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/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'
required: true
origin-channel:
description: 'Origin Channel'
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 }}
41 changes: 27 additions & 14 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,38 @@
# This is a template `release.yaml` file for ops charms
# This file is managed by bootstack-charms-spec and should not be modified
# within individual charm repos. https://launchpad.net/bootstack-charms-spec

name: Release to Edge

on:
push:
branches: [ master, main ]

concurrency:
group: release
cancel-in-progress: true
branches: [ main ]
release:
types: [ published ]

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

release:
needs: check
uses: canonical/bootstack-actions/.github/workflows/charm-release.yaml@v2
secrets: inherit
with:
channel: "latest/edge"
upload-image: false
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
if: ${{ inputs.destructive-mode == false }}
run: |
sudo lxd init --auto
# The following is needed to fix network error when creating new base instance on lxd
sudo chmod a+wr /var/snap/lxd/common/lxd/unix.socket
lxc network set lxdbr0 ipv6.address none
sudo usermod -a -G lxd $USER
if [[ $(cat /etc/os-release | grep VERSION_CODENAME) == *"jammy"* ]]; then
sudo iptables -F FORWARD
sudo iptables -P FORWARD ACCEPT
fi
- name: Upload charm to charmhub
uses: canonical/charming-actions/[email protected]
with:
credentials: "${{ secrets.CHARMHUB_TOKEN }}"
github-token: "${{ secrets.GITHUB_TOKEN }}"
channel: "latest/edge"
destructive-mode: false

0 comments on commit c391e3d

Please sign in to comment.