From 4dff0c6e664de8d141460cfb0cdfc26043835883 Mon Sep 17 00:00:00 2001 From: Henri Devigne Date: Sat, 1 Jun 2024 18:41:40 +0200 Subject: [PATCH] ci: add release action --- .github/workflows/main.yml | 70 ++++++++++++++++++++++++++++++ .github/workflows/pull_request.yml | 7 ++- .releaserc.json | 21 +++++++++ build/macos/Info.plist | 28 ++++++++++++ 4 files changed, 125 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/main.yml create mode 100644 .releaserc.json create mode 100644 build/macos/Info.plist diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..abb7797 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,70 @@ +name: Release +on: + push: + branches: + - main + +permissions: + contents: read + +jobs: + macos-build: + runs-on: macos-13 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: '1.22' + + - run: go build -o ipingtray + - run: go install github.com/machinebox/appify@latest + + - name: Create macOS app + run: | + appify -name "IPingTray" -icon docs/icon.png ipingtray + cp build/macos/Info.plist IpingTray.app/Contents/Info.plist + + - name: Install create-dmg + run: brew install create-dmg + + - name: Prepare DMG + run: | + mkdir dmg + mv iPingTray.app dmg/iPingTray.app + ln -s /Applications dmg/Applications + create-dmg iPingTray.dmg dmg + + - name: Upload DMG artifact + uses: actions/upload-artifact@v4 + with: + name: iPingTray.dmg + path: iPingTray.dmg + + release: + permissions: + contents: write + issues: write + pull-requests: write + needs: + - macos-build + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Download binaries + uses: actions/download-artifact@v4 + with: + path: dist + + - run: find . + - uses: actions/setup-node@v4 + with: + node-version: latest + + - name: "configure semantic-release" + run: npm install -D semantic-release @semantic-release/github + + - name: Semantic Release + uses: cycjimmy/semantic-release-action@v4 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 11aecac..b76ec69 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -24,4 +24,9 @@ jobs: - name: Super-linter uses: super-linter/super-linter@v6.5.1 env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + commitlint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: wagoid/commitlint-github-action@v6 \ No newline at end of file diff --git a/.releaserc.json b/.releaserc.json new file mode 100644 index 0000000..b1e669e --- /dev/null +++ b/.releaserc.json @@ -0,0 +1,21 @@ +{ + "branches": ["main"], + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + [ + "@semantic-release/github", + { + "assets": [ + { "path": "dist" } + ] + } + ], + "@semantic-release/github" + ], + "publish": ["@semantic-release/github"], + "verifyConditions": ["@semantic-release/github"], + "success": false, + "fail": false, + "npmPublish": false +} diff --git a/build/macos/Info.plist b/build/macos/Info.plist new file mode 100644 index 0000000..dab5352 --- /dev/null +++ b/build/macos/Info.plist @@ -0,0 +1,28 @@ + + + + + CFBundlePackageType + APPL + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + IPingTray + CFBundleExecutable + MacOS/IPingTray.app + CFBundleIdentifier + Appify by Machine Box.IPingTray + CFBundleVersion + 1.0 + CFBundleGetInfoString + IPingTray by Appify by Machine Box + CFBundleShortVersionString + 1.0 + CFBundleIconFile + icon.icns + + + LSUIElement + 1 + +