Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/add_tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Add version tag

on:
push:
branches:
- main

jobs:
tag:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Generate app token
id: app-token
uses: actions/create-github-app-token@v3
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}

- name: Extract version
id: version
run: |
VERSION=$(python3 -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
echo "value=$VERSION" >> "$GITHUB_OUTPUT"

- name: Create tag if new version
uses: actions/github-script@v8
with:
github-token: ${{ steps.app-token.outputs.token }}
script: |
const tag = `v${{ steps.version.outputs.value }}`;
try {
await github.rest.git.getRef({ owner: context.repo.owner, repo: context.repo.repo, ref: `tags/${tag}` });
core.info(`Tag ${tag} already exists, skipping`);
} catch (e) {
if (e.status === 404) {
await github.rest.git.createRef({ owner: context.repo.owner, repo: context.repo.repo, ref: `refs/tags/${tag}`, sha: context.sha });
core.info(`Created tag ${tag}`);
} else { throw e; }
}
9 changes: 5 additions & 4 deletions .github/workflows/appinspect.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ on:
push:
branches:
- main
- release
tags:
- "v*"
pull_request:
branches:
- main
Expand All @@ -27,11 +28,11 @@ jobs:
- name: Run AppInspect
uses: splunk/appinspect-cli-action@v2
with:
app_path: 'build/copycat.tgz'
app_path: build/copycat.tgz

- name: Upload app as artifact
if: github.event_name == 'push' && github.ref == 'refs/heads/release'
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-artifact@v7
with:
path: 'build/copycat.tgz'
path: build/copycat.tgz
compression-level: 0
7 changes: 0 additions & 7 deletions release.sh

This file was deleted.