Skip to content

Commit

Permalink
Publish policies separately
Browse files Browse the repository at this point in the history
  • Loading branch information
xiwenc committed Mar 31, 2024
1 parent ce9ffa2 commit 38dbcc2
Showing 1 changed file with 65 additions and 2 deletions.
67 changes: 65 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,33 @@
name: Release binaries
name: Release

on:
release:
types: [created]

jobs:
release-metadata:
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.get_release.outputs.upload_url }}
steps:
- name: Get existing release
id: get_release
uses: actions/github-script@v5
with:
script: |
const tag = context.ref.replace('refs/tags/', '');
let upload_url = '';
try {
const release = await github.rest.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag: tag
});
upload_url = release.data.upload_url;
} catch (error) {
core.setFailed(`Release for tag ${tag} not found.`);
}
core.setOutput('upload_url', upload_url);
releases-matrix:
name: Release Go Binary
runs-on: ubuntu-latest
Expand All @@ -25,4 +48,44 @@ jobs:
project_path: "./cmd/mendix-cli"
binary_name: "mendix-cli"
ldflags: "-s -w"
compress_assets: OFF
compress_assets: OFF
policies-zip-release:
runs-on: ubuntu-latest
needs: release-metadata
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Zip policies directory
run: zip -r policies.zip policies/

- name: Upload Release Asset (ZIP)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release-medatata.outputs.upload_url }}
asset_path: ./policies.zip
asset_name: policies.zip
asset_content_type: application/zip

policies-tar-gz-release:
runs-on: ubuntu-latest
needs: release-metadata
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Create Tar.gz policies directory
run: tar -czvf policies.tar.gz policies/

- name: Upload Release Asset (tar.gz)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release-medatata.outputs.upload_url }}
asset_path: ./policies.tar.gz
asset_name: policies.tar.gz
asset_content_type: application/gzip

0 comments on commit 38dbcc2

Please sign in to comment.