Skip to content

custom_event

custom_event #209

Workflow file for this run

name: Release to Github and artifact
on:
workflow_dispatch:
repository_dispatch:
types: [custom_event]
jobs:
release:
name: Release to github and artifact
runs-on: ubuntu-latest
env:
CI: false
appname: library
steps:
- uses: actions/checkout@v3
name: Check out code
- name: Version convert
id: convert_version
run: |
curl https://raw.githubusercontent.com/Websoft9/websoft9/main/docker/apphub/Dockerfile -o Dockerfile
library_tag=$(grep 'ARG LIBRARY_VERSION' "Dockerfile" | cut -d'"' -f2 | xargs)
apphub_tag=$(grep 'LABEL version' "Dockerfile" | cut -d'"' -f2 | xargs)
if [[ "$apphub_tag" == *"-"* ]]; then
suffix="${apphub_tag#*-}"
library_tag_gh="${library_tag}-${suffix}"
echo "CHANNEL=dev" >> $GITHUB_ENV
else
library_tag_gh=$library_tag
echo "CHANNEL=release" >> $GITHUB_ENV
fi
echo "LIBRARY_TAG=$library_tag" >> $GITHUB_ENV
echo "LIBRARY_TAG_GH=$library_tag_gh" >> $GITHUB_ENV
jq --arg version "$library_tag_gh" '.Version = $version' library.json > temp.json && mv temp.json library.json
- name: Create Zip Archive for artifact
run: |
mkdir ${{ env.appname }} artifacts
cp -r apps ${{ env.appname }}
cp -r docs ${{ env.appname }}
cp -r template ${{ env.appname }}
cp *.md ${{ env.appname }}
cp ${{ env.appname }}.json ${{ env.appname }}
cp ${{ env.appname }}.json CHANGELOG.md artifacts
zip -r ${{ env.appname }}-${{ env.LIBRARY_TAG }}.zip ${{ env.appname }}
cp ${{ env.appname }}-${{ env.LIBRARY_TAG }}.zip artifacts
cp artifacts/${{ env.appname }}-${{ env.LIBRARY_TAG }}.zip artifacts/${{ env.appname }}-latest.zip
- name: Upload zip files to Azure Blob
uses: LanceMcCarthy/Action-AzureBlobUpload@v2
with:
connection_string: ${{ secrets.AZURE_STORAGE_ARTIFACT }}
container_name: ${{ env.CHANNEL }}
source_folder: artifacts/
destination_folder: ./websoft9/plugin/${{ env.appname }}
delete_if_exists: true
fail_if_source_empty: true
- name: Create Github Release from code
uses: softprops/action-gh-release@v1
with:
files: |
${{ env.appname }}.json
tag_name: ${{ env.LIBRARY_TAG_GH }}
name: ${{ env.LIBRARY_TAG_GH }}
draft: false
prerelease: false
pages:
name: Build Github Pages
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
# Upload entire repository
path: '.'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v3