Skip to content

Commit 50b5d15

Browse files
committed
ci: simplify
1 parent c1882e1 commit 50b5d15

File tree

1 file changed

+21
-42
lines changed

1 file changed

+21
-42
lines changed
Lines changed: 21 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
name: Package and Release Tarot Deck
22

33
on:
4-
# Manual trigger
54
workflow_dispatch:
6-
# Run on push to main branch with tag
75
push:
86
branches:
97
- main
@@ -17,54 +15,35 @@ jobs:
1715
- name: Checkout code
1816
uses: actions/checkout@v3
1917

20-
- name: Set up environment
18+
- name: Extract version and package deck
19+
id: package
2120
run: |
22-
mkdir -p .github/workflows/scripts
23-
chmod +x .github/workflows/scripts/extract-version.sh
24-
chmod +x .github/workflows/scripts/create-package.sh
25-
26-
- name: Extract version
27-
id: version
28-
run: |
29-
VERSION=$(.github/workflows/scripts/extract-version.sh)
30-
echo "VERSION=$VERSION" >> $GITHUB_ENV
31-
echo "version=$VERSION" >> $GITHUB_OUTPUT
32-
33-
- name: Get current time
34-
id: current_time
35-
run: |
36-
echo "timestamp=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
37-
38-
- name: Create package
39-
id: create_package
40-
run: |
41-
# Run the script and capture the output (which should be just the filename)
42-
OUTPUT_FILE=$(.github/workflows/scripts/create-package.sh "${{ steps.version.outputs.version }}" "${{ steps.current_time.outputs.timestamp }}")
21+
VERSION=$(grep -E '^version\s*=\s*"[^"]+"' rider-waite-smith/deck.toml | sed -E 's/^version\s*=\s*"([^"]+)"/\1/')
22+
echo "Found version: $VERSION"
4323
44-
# Trim any whitespace
45-
OUTPUT_FILE=$(echo "$OUTPUT_FILE" | xargs)
24+
PACKAGE_NAME="rider-waite-smith-${VERSION}"
25+
ZIP_FILE="${PACKAGE_NAME}.zip"
26+
echo "Creating package: $ZIP_FILE"
4627
47-
echo "Generated package file: $OUTPUT_FILE"
28+
zip -r "${ZIP_FILE}" rider-waite-smith
29+
ls -la "${ZIP_FILE}"
4830
49-
# Verify the file exists
50-
if [ -f "$OUTPUT_FILE" ]; then
51-
echo "File exists and is readable"
52-
ls -la "$OUTPUT_FILE"
53-
echo "package_path=$OUTPUT_FILE" >> $GITHUB_OUTPUT
54-
else
55-
echo "ERROR
56-
tag_name: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || format('v{0}', steps.version.outputs.version) }}
31+
echo "version=$VERSION" >> $GITHUB_OUTPUT
32+
echo "zip_file=$ZIP_FILE" >> $GITHUB_OUTPUT
33+
34+
- name: Create Release
35+
if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/')
36+
uses: softprops/action-gh-release@v1
37+
with:
38+
files: ${{ steps.package.outputs.zip_file }}
39+
name: Rider-Waite-Smith Tarot Deck v${{ steps.package.outputs.version }}
40+
tag_name: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || format('v{0}', steps.package.outputs.version) }}
5741
draft: false
5842
prerelease: false
5943
body: |
60-
Rider-Waite-Smith Tarot Deck v${{ steps.version.outputs.version }}
61-
62-
This release contains the packaged Rider-Waite-Smith tarot deck according to the Tarot Deck Specification.
44+
Rider-Waite-Smith Tarot Deck v${{ steps.package.outputs.version }}
6345
64-
**Package Information:**
65-
- Version: ${{ steps.version.outputs.version }}
66-
- Build Date: ${{ steps.current_time.outputs.timestamp }}
67-
- Created by: ${{ github.actor }}
46+
This release contains the packaged Rider-Waite-Smith tarot deck version ${{ steps.package.outputs.version }} according to the Tarot Deck Specification.
6847
env:
6948
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7049

0 commit comments

Comments
 (0)