Skip to content

Commit

Permalink
try the action again (to revert)
Browse files Browse the repository at this point in the history
  • Loading branch information
javierdelapuente committed Apr 8, 2024
1 parent da65d2e commit 16a53ed
Showing 1 changed file with 27 additions and 16 deletions.
43 changes: 27 additions & 16 deletions .github/workflows/publish_charm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
push:
branches:
- main
pull_request:

env:
OWNER: ${{ github.repository_owner }}
Expand Down Expand Up @@ -100,7 +101,8 @@ jobs:
run-id: ${{ env.RUN_ID }}
steps:
- name: Get workflow run id
if: ${{ github.event_name == 'push' }}
# TODO JAVI TEST if: ${{ github.event_name == 'push' }}
if: false
shell: bash
run: |
# Get commit info
Expand Down Expand Up @@ -152,10 +154,15 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
- name: Get current run id
if: ${{ github.event_name == 'pull_request' }}
# TODO JAVI TEST if: ${{ github.event_name == 'pull_request' }}
if: false
shell: bash
run: |
echo "RUN_ID=${{ github.run_id }}" >> $GITHUB_ENV
- name: Get current run id (TODO TO TEST)
shell: bash
run: |
echo "RUN_ID=8597165771" >> $GITHUB_ENV
get-images:
name: Get images
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -256,21 +263,23 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Download images artifact
if: ${{ github.event_name == 'push' }}
# TODO JAVI TEST if: ${{ github.event_name == 'push' }}
run: |
gh run download ${{ needs.get-run-id.outputs.run-id }} -R ${{ github.repository }} -n ${{ env.CHARM_NAME }}-images
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Download images artifact (for testing)
uses: actions/download-artifact@v4
if: ${{ github.event_name == 'pull_request' }}
# TODO JAVI TEST if: ${{ github.event_name == 'pull_request' }}
if: false
with:
name: ${{ env.CHARM_NAME }}-images
- name: Publish image
env:
CHARMCRAFT_ENABLE_EXPERIMENTAL_EXTENSIONS: "true"
CHARMCRAFT_AUTH: ${{ secrets.CHARMHUB_TOKEN }}
run: |
set -x
charm=${{ env.CHARM_NAME }}
declare -a resources
declare -a images
Expand Down Expand Up @@ -390,29 +399,31 @@ jobs:
fi
echo "CHARM_NAME=$CHARM_NAME">> $GITHUB_ENV
- name: Download charm artifact
if: ${{ github.event_name == 'push' }}
# TODO JAVI TEST if: ${{ github.event_name == 'push' }}
run: |
gh run download ${{ needs.get-run-id.outputs.run-id }} -R ${{ github.repository }} -n ${{ env.CHARM_NAME }}-charm
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Download charm artifact (for testing)
uses: actions/download-artifact@v4
if: ${{ github.event_name == 'pull_request' }}
# TODO JAVI TEST if: ${{ github.event_name == 'pull_request' }}
if: false
with:
name: ${{ env.CHARM_NAME }}-charm
path: ${{ env.working_directory }}
- name: Get charm file
id: get-charm-file
run: |
set -x
echo charm_name: ${{ env.CHARM_NAME }}
echo "CHARM_FILE=$(ls ${{ env.CHARM_NAME }}_*.charm)"
echo "CHARM_FILE=$(ls ${{ env.CHARM_NAME }}_*.charm)" >> $GITHUB_OUTPUT
- name: Upload charm to charmhub
env:
CHARMCRAFT_ENABLE_EXPERIMENTAL_EXTENSIONS: "true"
CHARMCRAFT_AUTH: ${{ secrets.CHARMHUB_TOKEN }}
CHARM_FILE: ${{ steps.get-charm-file.outputs.CHARM_FILE }}
run: |
charmcraft resource-revisions netbox django-app-image
# it looks like this is not necessary, but it is what the canonical/charming-actions/upload-charm does.
MAX_REV=$(charmcraft resource-revisions netbox django-app-image --format=json | jq 'map( .revision) | max')
echo max_rev ${MAX_REV}
charmcraft upload --format json --release ${channel} ${CHARM_FILE} --resource=django-app-image:${MAX_REV}
uses: canonical/charming-actions/[email protected]
with:
built-charm-path: ${{ env.CHARM_FILE }}
credentials: ${{ secrets.CHARMHUB_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
channel: ${{ inputs.channel }}
tag-prefix: ${{ inputs.tag-prefix }}
upload-image: false

0 comments on commit 16a53ed

Please sign in to comment.