-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add build rock and charm steps to CI
- Loading branch information
1 parent
4a15b9b
commit 4325bc1
Showing
2 changed files
with
89 additions
and
18 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,89 @@ | ||
name: Deploy | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
env: | ||
CHARMCRAFT_ENABLE_EXPERIMENTAL_EXTENSIONS: true | ||
ROCKCRAFT_ENABLE_EXPERIMENTAL_EXTENSIONS: true | ||
|
||
jobs: | ||
pack-charm: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup LXD | ||
uses: canonical/setup-lxd@main | ||
|
||
- name: Setup Charmcraft | ||
run: sudo snap install charmcraft --classic --channel=edge/12f | ||
|
||
- name: Pack charm | ||
run: charmcraft pack -v --project-dir ./charm | ||
|
||
- name: Upload charm | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: dqlite-io-charm | ||
path: ./*.charm | ||
|
||
pack-rock: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
|
||
- name: Build Assets | ||
run: | | ||
yarn install | ||
yarn run build-css | ||
yarn run build-js | ||
- name: Setup LXD | ||
uses: canonical/setup-lxd@main | ||
|
||
- name: Setup Rockcraft | ||
run: sudo snap install rockcraft --classic --channel=edge/12f | ||
|
||
- name: Pack Rock | ||
run: rockcraft pack | ||
|
||
- name: Upload Rock | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: dqlite-io-rock | ||
path: ./*.rock | ||
|
||
publish-image: | ||
runs-on: ubuntu-latest | ||
needs: pack-rock | ||
outputs: | ||
image_url: ${{ steps.set_image_url.outputs.image_url }} | ||
steps: | ||
- name: Get Rock | ||
uses: actions/dowload-artifact@v3 | ||
with: | ||
name: dqlite-io-rock | ||
|
||
- name: Set image URL | ||
id: set_image_url | ||
run: echo "image-url=ghcr.io/canonical/dqlite.io:$(date +%s)-${GITHUB_SHA:0:7}" >> $GITHUB_OUTPUT | ||
|
||
- name: Push to GHCR | ||
run: skopeo --insecure-policy copy oci-archive:$(ls *.rock) docker://${{ steps.set_image_url.outputs.image_url }} --dest-creds "canonical:${{ secrets.GITHUB_TOKEN }}" | ||
|
||
deploy: | ||
runs-on: ubuntu-latest | ||
needs: publish-image | ||
steps: | ||
- name: Workflow run ID | ||
run : echo ${{ github.run_id }} | ||
- name: Image URL | ||
run : echo ${{ needs.publish-image.outputs.image_url }} |
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