Skip to content

fix bundle upload

fix bundle upload #11

name: Tag and Release
on:
push:
branches:
- main
jobs:
tag-new-versions:
name: Tag
runs-on: ubuntu-latest
outputs:
id: ${{ steps.maybe-release.outputs.id }}
tag: ${{ steps.maybe-tag.outputs.tag }}
steps:
- name: Check out Git repository
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Detect and Tag New Version
id: maybe-tag
uses: salsify/action-detect-and-tag-new-version@v2
- name: Create Release
id: maybe-release
if: ${{ success() && steps.maybe-tag.outputs.tag }}
uses: softprops/action-gh-release@v1
with:
name: ${{ steps.maybe-tag.outputs.tag }}
tag_name: ${{ steps.maybe-tag.outputs.tag }}
draft: true
- name: Upload metadata.json
if: ${{ success() && steps.maybe-tag.outputs.tag }}
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.maybe-release.outputs.upload_url }}
asset_path: ./metadata.json
asset_name: metadata.json
asset_content_type: application/json
- name: Install GitHub CLI
run: |
sudo apt update
sudo apt install -y gh
- name: Upload Bundle Files
if: ${{ success() && steps.maybe-tag.outputs.tag }}
run: |
for file in ./bundles/*; do
echo "Uploading ${file}..."
FILE_NAME=$(basename "${file}")
TAG_NAME=${{ steps.maybe-tag.outputs.tag }} # Ensure this is the correct tag output
echo "Tag: $TAG_NAME"
gh release upload "$TAG_NAME" "${file}" --repo wcpos/web-bundle --clobber
if [ $? -ne 0 ]; then
echo "Error uploading ${FILE_NAME}"
exit 1
fi
echo "Uploaded ${FILE_NAME}"
done