Skip to content

Commit bad5fdc

Browse files
committed
Add release github workflows github:9255
1 parent ca88122 commit bad5fdc

File tree

3 files changed

+136
-0
lines changed

3 files changed

+136
-0
lines changed

.github/workflows/.DS_Store

6 KB
Binary file not shown.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Create Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag_prefix:
7+
description: 'Tag prefix to use instead of branch'
8+
required: false
9+
default: ''
10+
type: string
11+
tag_suffix:
12+
description: 'Tag suffix'
13+
required: false
14+
default: ''
15+
type: string
16+
17+
jobs:
18+
create-tag-and-release:
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: write # for tag and release creation
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0 # Fetch all history and tags
27+
ref: ${{ github.ref }}
28+
token: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- name: Create Release Tag
31+
id: create_tag
32+
uses: e-marchand/auto-increment-tag-action@v2
33+
with:
34+
tag_prefix: "${{ inputs.tag_prefix }}"
35+
tag_suffix: "${{ inputs.tag_suffix }}"
36+
generate_commit_links: 'true'
37+
github_token: ${{ secrets.GITHUB_TOKEN }}
38+
39+
- name: Create GitHub Release
40+
if: steps.create_tag.outputs.tag_created == 'true'
41+
id: create_release
42+
uses: e-marchand/[email protected]
43+
with:
44+
tag_name: ${{ steps.create_tag.outputs.tag }}
45+
name: ${{ steps.create_tag.outputs.tag }}
46+
body: ${{ steps.create_tag.outputs.commit_links }}
47+
draft: false
48+
prerelease: ${{ contains(steps.create_tag.outputs.tag, 'main.') || contains(inputs.tag_suffix, '-') }}
49+
token: ${{ secrets.PAT_TOKEN }}

.github/workflows/release.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Release
2+
on:
3+
release:
4+
types: [published]
5+
jobs:
6+
create:
7+
name: "Create"
8+
runs-on: macOS
9+
env:
10+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
11+
steps:
12+
- name: ⬇️ Checkout
13+
uses: actions/checkout@v5
14+
15+
- name: ⬇️ Checkout postBuild
16+
uses: actions/checkout@v5
17+
with:
18+
repository: 4d/${{secrets.POST_BUILD_REPO}}
19+
token: ${{secrets.PAT_TOKEN}}
20+
sparse-checkout: |
21+
${{ secrets.POST_BUILD_PATH }}
22+
path: Components/${{ secrets.POST_BUILD_REPO }}
23+
24+
- name: BuildAndPackage
25+
id: build-package
26+
uses: 4d/build4d-action@main
27+
with:
28+
actions: "release"
29+
product-line: vcs
30+
version: vcs
31+
build: official
32+
token: ${{ secrets.DLTK }}
33+
after-build: "./Components/${{ secrets.POST_BUILD_REPO }}/${{ secrets.POST_BUILD_SCRIPT }}"
34+
sign-certificate: "${{ secrets.SIGN_CERTIFICATE }}"
35+
env:
36+
LOGIN_KEYCHAIN_PASSWORD: "${{ secrets.KEYCHAIN }}"
37+
38+
- name: Upload Artifact
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: "${{ github.event.repository.name }}.zip"
42+
path: "build/${{ github.event.repository.name }}.zip"
43+
retention-days: 1
44+
if-no-files-found: error
45+
46+
clear:
47+
needs: create
48+
if: failure()
49+
name: "Clear on failure"
50+
runs-on: ubuntu-latest
51+
permissions:
52+
contents: write # for release deletion
53+
steps:
54+
- name: 📄 Checkout repository
55+
uses: "actions/checkout@v5"
56+
with:
57+
fetch-depth: 0
58+
- name: Remove release
59+
run: |
60+
echo "Build and package step failed. Checking for errors..."
61+
echo "Removing release"
62+
gh release delete ${{github.event.release.tag_name}} || echo "Release deletion failed"
63+
env:
64+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65+
66+
publish:
67+
needs: create
68+
name: "Publish package"
69+
runs-on: ubuntu-latest
70+
71+
permissions:
72+
contents: write # for asset upload
73+
steps:
74+
- name: 📄 Checkout repository
75+
uses: "actions/checkout@v5"
76+
with:
77+
fetch-depth: 0
78+
- name: Download packages
79+
uses: actions/download-artifact@v4
80+
with:
81+
name: "${{ github.event.repository.name }}.zip"
82+
path: artifact
83+
- name: 📦 release package
84+
run: |
85+
gh release upload ${{github.event.release.tag_name}} "${{github.workspace}}/artifact/${{ github.event.repository.name }}.zip"
86+
env:
87+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)