Skip to content

Commit

Permalink
Implement Automated Release Workflow for XML Updates
Browse files Browse the repository at this point in the history
This commit introduces an updated GitHub Actions workflow in the feature/ci-cd-automation branch. The key features of this workflow are:

- It triggers exclusively on pushes to XML files in the feature/ci-cd-automation branch.
- On each push, it automatically zips the updated XML files with a date-stamped filename.
- It generates dynamic release notes based on the commit messages since the last release.
- It creates a draft release with the current date in the tag and release name.
- The zipped XML files are uploaded as assets to the draft release.

This setup allows for testing the automated release process in a controlled environment. The use of draft releases ensures that these automated releases are not visible to the public and can be reviewed and finalized manually.
  • Loading branch information
joshuafuller authored Jan 2, 2024
1 parent 4ee2373 commit 40fb652
Showing 1 changed file with 30 additions and 17 deletions.
47 changes: 30 additions & 17 deletions .github/workflows/zip_release.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,51 @@
name: CI/CD Pipeline for ATAK-Maps

on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

name: Upload Release Asset
branches:
- feature/ci-cd-automation # This workflow will run only on pushes to this branch
paths:
- '**/*.xml' # And only when there are changes in XML files

jobs:
build:
name: Upload Release Asset
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build project # This would actually build your project, using zip for an example artifact

- name: Get Date
id: date
run: echo "::set-output name=date::$(date +'%m-%d-%Y')"

- name: Zip the updated XML files
run: zip -r ATAK-Maps-${{ steps.date.outputs.date }}.zip . -i \*.xml

- name: Generate release notes
id: release_notes
run: |
zip -r ATAK-Maps . -i \*.xml
- name: Create Release
echo "release_notes<<EOF" >> $GITHUB_ENV
git log --pretty=format:"- %s" $(git describe --tags --abbrev=0 @^)..@ >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Create Draft Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
tag_name: draft-release-${{ steps.date.outputs.date }}
release_name: Draft Release ${{ steps.date.outputs.date }}
body: ${{ env.release_notes }}
draft: true # This marks the release as a draft
prerelease: false

- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./ATAK-Maps.zip
asset_name: ATAK-Maps.zip
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./ATAK-Maps-${{ steps.date.outputs.date }}.zip
asset_name: ATAK-Maps-${{ steps.date.outputs.date }}.zip
asset_content_type: application/zip

0 comments on commit 40fb652

Please sign in to comment.