This repository has been archived by the owner on Sep 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
arsic
authored and
arsic
committed
Aug 14, 2023
1 parent
2e4f1d3
commit 3e15374
Showing
2 changed files
with
108 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
--- | ||
name: build | ||
|
||
on: | ||
push: | ||
branches: | ||
master | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
name: Build ankiaddon | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: zip and rename | ||
shell: bash | ||
run: ./build.sh | ||
|
||
- name: upload | ||
uses: actions/[email protected] | ||
with: | ||
name: ankicord.ankiaddon | ||
path: ./ankicord.ankiaddon | ||
|
||
create-release: | ||
name: create release | ||
needs: build | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
outputs: | ||
upload_url: ${{ steps.create-release.outputs.upload_url }} | ||
|
||
steps: | ||
- name: set env vars for release | ||
run: | | ||
echo "tag_name=nightly-build" >> $GITHUB_ENV | ||
echo "release_name=Nightly Release" >> $GITHUB_ENV | ||
- name: delete previous nightly release and tag | ||
uses: actions/[email protected] | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
try { | ||
const { owner, repo } = context.repo; | ||
const release = await github.rest.repos.getReleaseByTag({ | ||
owner: owner, | ||
repo: repo, | ||
tag: process.env.tag_name | ||
}) | ||
await github.rest.repos.deleteRelease({ | ||
owner, | ||
repo, | ||
release_id: release.data.id | ||
}) | ||
await github.rest.git.deleteRef({ | ||
owner, | ||
repo, | ||
ref: `tags/${process.env.tag_name}` | ||
}) | ||
} catch (err) { | ||
core.error(`error deleting release or tag: ${err}`) | ||
} | ||
- name: create new nightly tag and release | ||
id: create-release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ env.tag_name }} | ||
release_name: ${{ env.release_name }} | ||
draft: false | ||
prerelease: true | ||
|
||
upload-release-assets: | ||
name: upload release | ||
needs: [config, create-release] | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
|
||
steps: | ||
- name: download artifact | ||
uses: actions/[email protected] | ||
with: | ||
name: ankicord.ankiaddon | ||
path: ./ubuntu-latest | ||
|
||
- name: upload release asset | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ needs.create-release.outputs.upload_url }} | ||
asset_path: ./ubuntu-latest/ankicord.ankiaddon | ||
asset_name: ankicord.ankiaddon | ||
asset_content_type: application/zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters