|
| 1 | +name: Auto Create Combined Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + |
| 7 | +jobs: |
| 8 | + create-release: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + |
| 11 | + steps: |
| 12 | + - name: Checkout repo |
| 13 | + uses: actions/checkout@v3 |
| 14 | + |
| 15 | + - name: Install yq for YAML parsing |
| 16 | + run: | |
| 17 | + YQ_VERSION=v4.45.1 |
| 18 | + wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64 |
| 19 | + chmod +x /usr/local/bin/yq |
| 20 | +
|
| 21 | +
|
| 22 | + - name: Read major version and generate date-based minor version |
| 23 | + id: version |
| 24 | + run: | |
| 25 | + MAJOR=$(yq '.major' .release-config.yaml) |
| 26 | + DATE=$(date +%y%m%d) |
| 27 | + TIME=$(date +%H%M) |
| 28 | + echo "version=${MAJOR}.${DATE}.${TIME}" >> $GITHUB_OUTPUT |
| 29 | +
|
| 30 | + - name: Prepare Slides Structure ZIP |
| 31 | + run: | |
| 32 | + mkdir -p slides-structure |
| 33 | +
|
| 34 | + INCLUDE=$(yq '.release.slides_structure.include[]' .release-config.yaml) |
| 35 | + for path in $INCLUDE; do |
| 36 | + cp -r "$path" slides-structure/ |
| 37 | + done |
| 38 | + EXCLUDE=$(yq '.release.slides_structure.exclude[]' .release-config.yaml) |
| 39 | + for path in $EXCLUDE; do |
| 40 | + rm -rf "slides-structure/$path" || true |
| 41 | + done |
| 42 | + |
| 43 | + cd slides-structure && zip -r ../slides-structure.zip . |
| 44 | +
|
| 45 | + - name: Prepare AGHMD Beamer Theme ZIP |
| 46 | + run: | |
| 47 | + mkdir -p beamer-theme-aghmd |
| 48 | + |
| 49 | + INCLUDE=$(yq '.release.aghmd_beamer_theme.include[]' .release-config.yaml) |
| 50 | + for path in $INCLUDE; do |
| 51 | + cp -r "$path" beamer-theme-aghmd/ |
| 52 | + done |
| 53 | + EXCLUDE=$(yq '.release.aghmd_beamer_theme.exclude[]' .release-config.yaml) |
| 54 | + for path in $EXCLUDE; do |
| 55 | + rm -rf "beamer-theme-aghmd/$path" || true |
| 56 | + done |
| 57 | + |
| 58 | + cd beamer-theme-aghmd && zip -r ../beamer-theme-aghmd.zip . |
| 59 | +
|
| 60 | + - name: Create Git tag for combined release |
| 61 | + run: | |
| 62 | + git config user.name "github-actions" |
| 63 | + git config user.email "github-actions@users.noreply.github.com" |
| 64 | + TAG="combined-release-v${{ steps.version.outputs.version }}" |
| 65 | + git tag $TAG |
| 66 | + git push origin $TAG |
| 67 | + env: |
| 68 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 69 | + |
| 70 | + - name: Create GitHub Release with both ZIPs |
| 71 | + uses: softprops/action-gh-release@v2 |
| 72 | + with: |
| 73 | + name: "Combined Release - v${{ steps.version.outputs.version }}" |
| 74 | + tag_name: "combined-release-v${{ steps.version.outputs.version }}" |
| 75 | + files: | |
| 76 | + slides-structure.zip |
| 77 | + beamer-theme-aghmd.zip |
| 78 | + env: |
| 79 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments