Skip to content

Commit f8fecc3

Browse files
committed
chore: clean up CI workflows by removing unused release job and updating permissions
1 parent af15bcc commit f8fecc3

File tree

3 files changed

+86
-135
lines changed

3 files changed

+86
-135
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ name: CI
33
on:
44
push:
55
branches: ['master', 'develop']
6-
tags:
7-
- 'v*.*.*'
86
pull_request:
97
branches: ['master', 'develop', 'feature/*']
108

@@ -352,144 +350,14 @@ jobs:
352350
fail-on-severity: moderate
353351
comment-summary-in-pr: always
354352

355-
release:
356-
name: Release
357-
runs-on: ubuntu-latest
358-
if: github.ref_type == 'tag'
359-
permissions:
360-
contents: write
361-
needs: ['test']
362-
steps:
363-
- uses: actions/checkout@v5
364-
with:
365-
fetch-depth: 0
366-
367-
- name: Set up Go
368-
uses: actions/setup-go@v6
369-
with:
370-
go-version-file: 'go.mod'
371-
check-latest: true
372-
373-
- name: Run tests
374-
run: |
375-
echo "## 🚀 Release Tests" >> $GITHUB_STEP_SUMMARY
376-
echo "" >> $GITHUB_STEP_SUMMARY
377-
378-
go test -v ./... 2>&1 | tee release-test-output.log
379-
TEST_STATUS=$?
380-
381-
TOTAL_TESTS=$(grep -c "=== RUN" release-test-output.log || echo "0")
382-
PASSED_TESTS=$(grep -c "--- PASS:" release-test-output.log || echo "0")
383-
FAILED_TESTS=$(grep -c "--- FAIL:" release-test-output.log || echo "0")
384-
385-
echo "| Metric | Value |" >> $GITHUB_STEP_SUMMARY
386-
echo "|--------|-------|" >> $GITHUB_STEP_SUMMARY
387-
echo "| Total Tests | $TOTAL_TESTS |" >> $GITHUB_STEP_SUMMARY
388-
echo "| Passed | ✅ $PASSED_TESTS |" >> $GITHUB_STEP_SUMMARY
389-
echo "| Failed | ❌ $FAILED_TESTS |" >> $GITHUB_STEP_SUMMARY
390-
echo "| Status | $([ $TEST_STATUS -eq 0 ] && echo "✅ PASSED" || echo "❌ FAILED") |" >> $GITHUB_STEP_SUMMARY
391-
echo "" >> $GITHUB_STEP_SUMMARY
392-
393-
exit $TEST_STATUS
394-
395-
- name: Install UPX
396-
run: |
397-
sudo apt-get update
398-
sudo apt-get install -y upx
399-
400-
- name: Build binaries
401-
run: |
402-
echo "## 🔨 Build Process" >> $GITHUB_STEP_SUMMARY
403-
echo "" >> $GITHUB_STEP_SUMMARY
404-
405-
# Set the build time environment variable using git commit timestamp
406-
BUILD_TIME=$(git log -1 --format=%cd --date=iso-strict)
407-
408-
# Add run permissions to the build script
409-
chmod +x ./scripts/build.sh
410-
411-
# Display help information for the build script
412-
./scripts/build.sh --help
413-
414-
echo "**Build Configuration:**" >> $GITHUB_STEP_SUMMARY
415-
echo "- Version: ${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY
416-
echo "- Build Time: $BUILD_TIME" >> $GITHUB_STEP_SUMMARY
417-
echo "- Git Commit: ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY
418-
echo "" >> $GITHUB_STEP_SUMMARY
419-
420-
# Build for all platforms
421-
./scripts/build.sh \
422-
--verbose \
423-
-ldflags "-s -w -X github.com/kjanat/articulate-parser/internal/version.Version=${{ github.ref_name }} -X github.com/kjanat/articulate-parser/internal/version.BuildTime=$BUILD_TIME -X github.com/kjanat/articulate-parser/internal/version.GitCommit=${{ github.sha }}"
424-
425-
- name: Compress binaries with UPX
426-
run: |
427-
echo "## 📦 Binary Compression" >> $GITHUB_STEP_SUMMARY
428-
echo "" >> $GITHUB_STEP_SUMMARY
429-
430-
echo "Compressing binaries with UPX..."
431-
cd build/
432-
433-
# Get original sizes
434-
echo "**Original sizes:**" >> $GITHUB_STEP_SUMMARY
435-
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
436-
ls -lah >> $GITHUB_STEP_SUMMARY
437-
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
438-
echo "" >> $GITHUB_STEP_SUMMARY
439-
440-
# Compress all binaries except Darwin (macOS) binaries as UPX doesn't work well with recent macOS versions
441-
for binary in articulate-parser-*; do
442-
echo "Compressing $binary..."
443-
upx --best "$binary" || {
444-
echo "Warning: UPX compression failed for $binary, keeping original"
445-
}
446-
447-
# if [[ "$binary" == *"darwin"* ]]; then
448-
# echo "Skipping UPX compression for $binary (macOS compatibility)"
449-
# else
450-
# echo "Compressing $binary..."
451-
# upx --best "$binary" || { # removed `--lzma`
452-
# echo "Warning: UPX compression failed for $binary, keeping original"
453-
# }
454-
# fi
455-
done
456-
457-
echo "**Final sizes:**" >> $GITHUB_STEP_SUMMARY
458-
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
459-
ls -lah >> $GITHUB_STEP_SUMMARY
460-
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
461-
echo "" >> $GITHUB_STEP_SUMMARY
462-
463-
- name: Upload a Build Artifact
464-
uses: actions/[email protected]
465-
with:
466-
name: build-artifacts
467-
path: build/
468-
if-no-files-found: ignore
469-
retention-days: 1
470-
compression-level: 9
471-
overwrite: true
472-
include-hidden-files: true
473-
474-
- name: Create Release
475-
uses: softprops/action-gh-release@v2
476-
with:
477-
files: build/*
478-
generate_release_notes: true
479-
draft: false
480-
# Mark v0.x.x releases as prerelease (pre-1.0 versions are considered unstable)
481-
prerelease: ${{ startsWith(github.ref, 'refs/tags/v0.') }}
482-
env:
483-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
484-
485353
docker:
486354
name: Docker Build & Push
487355
runs-on: ubuntu-latest
488356
permissions:
489357
contents: read
490358
packages: write
491359
needs: ['test']
492-
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/feature/docker'))
360+
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/feature/docker'))
493361
steps:
494362
- name: Checkout repository
495363
uses: actions/checkout@v5

.github/workflows/dependency-review.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ permissions:
1010
contents: read
1111
# Required to post security advisories
1212
security-events: write
13+
pull-requests: write
1314

1415
jobs:
1516
dependency-review:

.github/workflows/release.yml

Lines changed: 84 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@ name: Release
33
on:
44
push:
55
tags:
6-
- 'v*.*.*'
6+
- "v*.*.*"
7+
workflow_call:
8+
9+
env:
10+
REGISTRY: ghcr.io
11+
IMAGE_NAME: ${{ github.repository }}
712

813
permissions:
914
contents: write
15+
packages: write
1016

1117
jobs:
1218
release:
@@ -21,7 +27,7 @@ jobs:
2127
- name: Set up Go
2228
uses: actions/setup-go@v6
2329
with:
24-
go-version-file: 'go.mod'
30+
go-version-file: "go.mod"
2531
check-latest: true
2632

2733
- name: Run tests
@@ -72,3 +78,79 @@ jobs:
7278
prerelease: ${{ startsWith(github.ref, 'refs/tags/v0.') }}
7379
env:
7480
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81+
82+
docker:
83+
name: Docker Build & Push
84+
runs-on: ubuntu-latest
85+
needs: ['release']
86+
permissions:
87+
contents: read
88+
packages: write
89+
steps:
90+
- name: Checkout repository
91+
uses: actions/checkout@v5
92+
93+
- name: Login to Docker Hub
94+
uses: docker/login-action@v3
95+
with:
96+
username: ${{ vars.DOCKERHUB_USERNAME }}
97+
password: ${{ secrets.DOCKERHUB_TOKEN }}
98+
99+
- name: Log in to GitHub Container Registry
100+
uses: docker/login-action@v3
101+
with:
102+
registry: ${{ env.REGISTRY }}
103+
username: ${{ github.actor }}
104+
password: ${{ secrets.GITHUB_TOKEN }}
105+
106+
- name: Set up QEMU
107+
uses: docker/setup-qemu-action@v3
108+
109+
- name: Set up Docker Buildx
110+
uses: docker/setup-buildx-action@v3
111+
112+
- name: Extract metadata
113+
id: meta
114+
uses: docker/metadata-action@v5
115+
with:
116+
images: |
117+
${{ env.IMAGE_NAME }}
118+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
119+
tags: |
120+
type=semver,pattern={{version}}
121+
type=semver,pattern={{major}}.{{minor}}
122+
type=semver,pattern={{major}}
123+
type=raw,value=latest,enable={{is_default_branch}}
124+
labels: |
125+
org.opencontainers.image.title=Articulate Parser
126+
org.opencontainers.image.description=A powerful CLI tool to parse Articulate Rise courses and export them to multiple formats including Markdown HTML and DOCX. Supports media extraction content cleaning and batch processing for educational content conversion.
127+
org.opencontainers.image.vendor=kjanat
128+
org.opencontainers.image.licenses=MIT
129+
org.opencontainers.image.url=https://github.com/${{ github.repository }}
130+
org.opencontainers.image.source=https://github.com/${{ github.repository }}
131+
org.opencontainers.image.documentation=https://github.com/${{ github.repository }}/blob/master/DOCKER.md
132+
133+
- name: Build and push Docker image
134+
uses: docker/build-push-action@v6
135+
with:
136+
context: .
137+
platforms: |
138+
linux/amd64
139+
linux/arm64
140+
linux/arm/v7
141+
linux/386
142+
linux/ppc64le
143+
linux/s390x
144+
push: true
145+
tags: ${{ steps.meta.outputs.tags }}
146+
labels: ${{ steps.meta.outputs.labels }}
147+
annotations: ${{ steps.meta.outputs.labels }}
148+
build-args: |
149+
VERSION=${{ github.ref_name }}
150+
BUILD_TIME=${{ github.event.head_commit.timestamp || github.event.repository.pushed_at }}
151+
GIT_COMMIT=${{ github.sha }}
152+
cache-from: type=gha
153+
cache-to: type=gha,mode=max
154+
outputs: type=image,name=target,annotation-index.org.opencontainers.image.description=A powerful CLI tool to parse Articulate Rise courses and export them to multiple formats including Markdown HTML and DOCX. Supports media extraction content cleaning and batch processing for educational content conversion.
155+
sbom: true
156+
provenance: true

0 commit comments

Comments
 (0)