Skip to content

Commit

Permalink
Merge branch 'master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiroki Fujii committed Jan 21, 2024
2 parents 8470583 + c4a1dfe commit 19059e3
Show file tree
Hide file tree
Showing 12 changed files with 260 additions and 192 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/pullRequest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: check for pull request into master

on:
pull_request:
branches:
- master

jobs:
build:
uses: ./.github/workflows/testAndBuild.yml
50 changes: 50 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build and release for official

on:
push:
tags:
- "*.*.*"

jobs:
build:
uses: ./.github/workflows/testAndBuild.yml
with:
official_release: true

deploy:
needs: build
runs-on: windows-latest

steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ${{ github.event.repository.name }}
path: ./

- name: Deploy to GitHub
uses: softprops/action-gh-release@v1
with:
body: ${{ github.event.repository.name }} official release
draft: true
files: |
./${{ github.event.repository.name }}-*.zip
./*-*.nvda-addon
./${{ github.event.repository.name }}-*.json
error_notify:
runs-on: ubuntu-latest
needs: deploy
if: ${{ failure() }}
steps:
- name: Send GitHub Action trigger data to Slack workflow
uses: slackapi/slack-github-action@v1
with:
payload: |
{
"text": "Github actions build failed! <${{ github.server_url }}/${{ github.repository }}|${{ github.event.repository.name }}>のofficial releaseビルドが失敗しました。\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|対象のrun>お確認し、対応着手時・完了後は、本チャンネルにて経緯を報告ください。"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_ALERT_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK

84 changes: 84 additions & 0 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Build and release for snapshot

on:
push:
branches:
- master

jobs:
build:
uses: ./.github/workflows/testAndBuild.yml

deploy:
needs: build
runs-on: windows-latest

steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ${{ github.event.repository.name }}
path: ./

- name: Re-create the tag
uses: actions/github-script@v7
with:
script: |
const { owner, repo } = context.repo
const tagName = repo + "-latestcommit"
try {
// Fetch the release by its tag
const { data: release } = await github.rest.repos.getReleaseByTag({ owner, repo, tag: tagName })
// Delete the release if exists
await github.rest.repos.deleteRelease({ owner, repo, release_id: release.id })
console.log("deleted release");
} catch(err) {
if(err.status !== 404){
throw err;
}
console.log('No release found for deletion');
}
try {
await github.rest.git.deleteRef({owner, repo, ref: "tags/" + tagName})
console.log("deleted tag");
} catch(err) {
console.log('Failed to delete tag'+err.message);
}
try {
await github.rest.git.createRef({owner, repo, ref: "refs/tags/" + tagName, sha: context.sha})
console.log("created tag");
} catch(err) {
console.log('Failed to create tag'+err.message);
}
- name: Deploy to GitHub
uses: softprops/action-gh-release@v1
with:
name: Snapshot
tag_name: ${{ github.event.repository.name }}-latestcommit
body: Automatic build from master branch
files: |
./${{ github.event.repository.name }}-*.zip
./*-*.nvda-addon
./${{ github.event.repository.name }}-*.json
- name: register snapshot to actlab site
run: |
curl "https://actlab.org/api/addAlphaVersion?repo_name=${{ github.repository }}&commit_hash=${{ github.sha }}&version=${{ needs.build.outputs.build_version }}&password=${{ secrets.SCRIPT_PASSWORD }}"
error_notify:
runs-on: ubuntu-latest
needs: deploy
if: ${{ failure() }}
steps:
- name: Send GitHub Action trigger data to Slack workflow
uses: slackapi/slack-github-action@v1
with:
payload: |
{
"text": "Github actions build failed! <${{ github.server_url }}/${{ github.repository }}|${{ github.event.repository.name }}>のビルドが失敗しました。\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|対象のrun>お確認し、対応着手時・完了後は、本チャンネルにて経緯を報告ください。"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_ALERT_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK

68 changes: 68 additions & 0 deletions .github/workflows/testAndBuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Test and build

on:
workflow_call:
inputs:
official_release:
description: Whether this is an official release
default: false
type: boolean
outputs:
build_version:
description: Version of the built package
value: ${{ jobs.build.outputs.build_version }}

jobs:
build:
runs-on: windows-latest
outputs:
build_version: ${{ steps.output_version.outputs.version }}

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
architecture: x86
python-version: 3.8
cache: pip

- name: Install requirements
run: |
python -m pip install -r requirements.txt
- name: Test
run: |
echo skiped tests
- name: Set tag name if This is an official release
run: echo "TAG_NAME=$($env:GITHUB_REF.Replace('refs/tags/', ''))" >> $env:GITHUB_ENV
if: ${{ inputs.official_release }}

- name: Build
run: |
python tools\build.py
env:
COMMIT_TIMESTAMP: ${{ github.event.head_commit.timestamp}}

- name: output version
id: output_version
shell: python
run: |
import os, sys
sys.path.append(os.getcwd())
import buildVars
with open(os.environ["GITHUB_OUTPUT"], mode = "a") as f:
f.write("version="+buildVars.ADDON_VERSION)
- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}
path: |
./${{ github.event.repository.name }}-*.zip
./*-*.nvda-addon
./${{ github.event.repository.name }}-*.json
15 changes: 7 additions & 8 deletions addon/globalPlugins/dokutor_for_nvda/updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ def __init__(self):
if not updatable:
log.warning("Update check not supported.")

def autoUpdateCheck(self, mode=0):
def autoUpdateCheck(self, mode=AUTO):
"""
Call this method to check for updates. mode=AUTO means automatic update check, and MANUAL means manual triggering like "check for updates" menu invocation.
When set to AUTO mode, some dialogs are not displayed (latest and error).
"""

if not updatable:
return
self.updater = NVDAAddOnUpdater(mode)
Expand Down Expand Up @@ -212,7 +217,7 @@ def _download(self, url):
def _downloadSuccess(self):
self._stopped()
from gui import addonGui
closeAfter = addonGui.AddonsDialog._instance is None or (versionInfo.version_year, versionInfo.version_major) >= (2019, 1)
addonGui.promptUserForRestart()
try:
try:
bundle = addonHandler.AddonBundle(self.destPath.decode("mbcs"))
Expand All @@ -236,23 +241,17 @@ def _downloadSuccess(self):
gui.ExecAndPump(addonHandler.installAddonBundle, bundle)
except BaseException:
log.error("Error installing addon bundle from %s" % self.destPath, exc_info=True)
if not closeAfter:
addonGui.AddonsDialog(gui.mainFrame).refreshAddonsList()
progressDialog.done()
del progressDialog
gui.messageBox(_("アドオンのアップデートに失敗しました。"),
_("エラー"),
wx.OK | wx.ICON_ERROR)
return
else:
if not closeAfter:
addonGui.AddonsDialog(gui.mainFrame).refreshAddonsList(activeIndex=-1)
progressDialog.done()
del progressDialog
finally:
self.cleanup_tempfile()
if closeAfter:
wx.CallLater(1, addonGui.AddonsDialog(gui.mainFrame).Close)

def cleanup_tempfile(self):
if not os.path.isfile(self.destPath):
Expand Down
55 changes: 0 additions & 55 deletions appveyor-release.yml

This file was deleted.

73 changes: 0 additions & 73 deletions appveyor.yml

This file was deleted.

Loading

0 comments on commit 19059e3

Please sign in to comment.