-
-
Notifications
You must be signed in to change notification settings - Fork 186
64 lines (54 loc) · 2.03 KB
/
publish-to-foxycart.yml
File metadata and controls
64 lines (54 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Update FoxyCart Downloadables
on:
workflow_dispatch:
release:
types: [published]
permissions:
contents: read
jobs:
update-foxycart:
runs-on: ubuntu-latest
env:
FOXYCART_CLIENT_ID: ${{ secrets.FOXYCART_CLIENT_ID }}
FOXYCART_CLIENT_SECRET: ${{ secrets.FOXYCART_CLIENT_SECRET }}
FOXYCART_REFRESH_TOKEN: ${{ secrets.FOXYCART_REFRESH_TOKEN }}
FOXYCART_STORE_ID: ${{ secrets.FOXYCART_STORE_ID }}
RELEASE_ASSETS_DIR: ${{ github.workspace }}/release_assets
steps:
- name: Checkout repository
uses: actions/checkout@v6.0.2
with:
fetch-depth: 0
# Determine TAG_NAME for both release and manual runs
- name: Set TAG_NAME variable
id: set_tag
run: |
if [ "${{ github.event.release.tag_name }}" != "" ]; then
echo "tag_name=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT
else
TAG=$(git tag --sort=-creatordate | head -n 1)
if [ -z "$TAG" ]; then
echo "❌ No git tags found. Please create a release tag before running this workflow."
exit 1
fi
echo "tag_name=$TAG" >> $GITHUB_OUTPUT
fi
- name: Download release assets
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mkdir -p "$RELEASE_ASSETS_DIR"
echo "Downloading assets for tag: ${{ steps.set_tag.outputs.tag_name }} to directory: $RELEASE_ASSETS_DIR"
gh release download "${{ steps.set_tag.outputs.tag_name }}" --dir "$RELEASE_ASSETS_DIR" --clobber
ls -al "$RELEASE_ASSETS_DIR"
- name: Set up Python
uses: actions/setup-python@v6.2.0
with:
python-version: '3.x'
- name: Install dependencies
run: pip install requests
- name: Update FoxyCart downloadables
run: python scripts/update_foxycart_downloadables.py
env:
GITHUB_RELEASE_TAG: ${{ steps.set_tag.outputs.tag_name }}
RELEASE_ASSETS_DIR: ${{ env.RELEASE_ASSETS_DIR }}