Skip to content

Commit

Permalink
Release on every push to the main branch
Browse files Browse the repository at this point in the history
Signed-off-by: Taylor Smock <[email protected]>
  • Loading branch information
tsmock committed Feb 21, 2023
1 parent 968d611 commit 68907f5
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 5 deletions.
62 changes: 57 additions & 5 deletions .github/workflows/ant-release.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
name: Release

on:
release:
types: [created]
push:
tags:
- v.**
workflow_call:
inputs:
tag:
required: true
type: string

jobs:
call-workflow:
Expand All @@ -11,7 +17,53 @@ jobs:
josm-revision: "r18589"
update-pluginssource: true
plugin-jar-name: 'mapwithai'
secrets:
trac-username: ${{ secrets.TRAC_USERNAME }}
trac-password: ${{ secrets.TRAC_PASSWORD }}


createrelease:
needs: call-workflow
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Set revision env variable
id: create_revision
run: |
if [[ ! -z "${{ inputs.tag }}" ]]; then
revision="${{ inputs.tag }}"
else
revision="${{ github.ref_name }}"
fi
echo "revision=$revision" >> $GITHUB_OUTPUT
echo "revision_number=${revision#v}" >> $GITHUB_OUTPUT
- name: Get build
id: cache-plugin-build
uses: actions/[email protected]
with:
key: ${{ github.event.repository.name }}-${{ github.sha }}-${{ steps.create_revision.outputs.revision_number }}
path: |
josm/dist/mapwithai.jar
josm/dist/mapwithai-javadoc.jar
josm/dist/mapwithai-sources.jar
- name: Generate update site
id: create_update_site
run: |
ls -R .
jarname="mapwithai.jar"
jarurl="https://github.com/${{ github.repository }}/releases/download/${{ steps.create_revision.outputs.revision }}/${jarname}"
echo "${jarname};$jarurl" > updatesite
unzip -p "josm/dist/${jarname}" META-INF/MANIFEST.MF | sed 's/^/\t/' >> updatesite
- name: Release
run: |
target="${{ steps.create_revision.outputs.revision }}"
if [ -z "$(gh --repo ${{ github.repository }} release view \"${target}\")" ]; then
gh release --repo ${{ github.repository }} create "${target}" \
--title "${target}" \
--latest \
--generate-notes
fi
gh release --repo ${{ github.repository }} upload --clobber "${target}" \
"josm/dist/mapwithai.jar" \
"josm/dist/mapwithai-javadoc.jar" \
"josm/dist/mapwithai-sources.jar" \
"updatesite"
env:
GH_TOKEN: ${{ github.token }}
29 changes: 29 additions & 0 deletions .github/workflows/ant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,32 @@ jobs:
uses: JOSM/JOSMPluginAction/.github/workflows/ant.yml@v1
with:
josm-revision: ${{ matrix.josm-revision }}
createtag:
if: ${{ github.repository == 'JOSM/MapWithAI' && github.ref_type == 'branch' && github.ref_name == 'master' }}
needs: call-workflow
name: Create Tag
runs-on: ubuntu-latest
outputs:
revision: ${{ steps.create_revision.outputs.revision }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set revision env variable
id: create_revision
# Count the total commits for this branch
run: |
revision="v$(git rev-list --count HEAD)"
git tag $revision
git push -u origin $revision
echo "revision=$revision" >> $GITHUB_OUTPUT
releasing:
needs: createtag
name: Run release actions
uses: ./.github/workflows/ant-release.yml
with:
tag: ${{ needs.createtag.outputs.revision }}
secrets: inherit

0 comments on commit 68907f5

Please sign in to comment.