-
Notifications
You must be signed in to change notification settings - Fork 49
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
Showing
1 changed file
with
98 additions
and
6 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 |
---|---|---|
|
@@ -10,7 +10,8 @@ on: | |
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
build: | ||
|
||
release: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
|
@@ -67,16 +68,107 @@ jobs: | |
|
||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: Release Build | ||
name: Pre-release Build | ||
path: dist/* | ||
|
||
- name: Create Release | ||
id: create_release | ||
- name: Create Pre-release | ||
id: create_pre_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Pre-release ${{ github.ref }} | ||
release_name: Pre-release ${{ steps.tag.outputs.result }} | ||
draft: true | ||
prerelease: true | ||
prerelease: true | ||
|
||
- name: Output Release URL File | ||
run: echo "${{ steps.create_pre_release.outputs.upload_url }}" > release_url.txt | ||
|
||
- name: Save Release URL File for publish | ||
uses: actions/upload-artifact@v1 | ||
with: | ||
name: release_url | ||
path: release_url.txt | ||
|
||
publish: | ||
# from https://github.com/actions/create-release/issues/14#issuecomment-555379810 | ||
if: contains(github.ref, 'tags/v') | ||
needs: [release] | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: 'recursive' | ||
|
||
- name: Load Release URL File from release job | ||
uses: actions/download-artifact@v1 | ||
with: | ||
name: release_url | ||
|
||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: 'recursive' | ||
|
||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Setup pip cache | ||
uses: actions/cache@v2 | ||
timeout-minutes: 5 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-3.x-pip-${{ hashFiles('**/requirements.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-3.x-pip- | ||
- name: Install deps | ||
run: | | ||
pip install -r test-requirements.txt && | ||
pip install -e . | ||
timeout-minutes: 3 | ||
|
||
- name: Install Pyinstaller | ||
run: | | ||
git clone https://github.com/pyinstaller/pyinstaller.git --branch master | ||
cd pyinstaller/bootloader | ||
python ./waf distclean all | ||
cd .. | ||
python setup.py install | ||
- name: Build the executable | ||
run: | | ||
python -m pip uninstall -y freenom-dns-updater | ||
python -O -m PyInstaller -y --clean --console freenom_dns_updater/scripts/fdu.py | ||
- name: Zip the executable | ||
uses: papeloto/action-zip@v1 | ||
with: | ||
files: dist/fdu/ | ||
dest: ${{ runner.os }}.zip | ||
|
||
- name: Get Release File Name & Upload URL | ||
id: get_release_info | ||
run: | | ||
echo ::set-output name=file_name::${REPOSITORY_NAME##*/}-${TAG_REF_NAME##*/v} # RepositoryName-v1.0.0 | ||
value=`cat release_url/release_url.txt` | ||
echo ::set-output name=upload_url::$value | ||
env: | ||
TAG_REF_NAME: ${{ github.ref }} | ||
REPOSITORY_NAME: ${{ github.repository }} | ||
|
||
- name: Upload Release Asset | ||
id: upload-release-asset | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.get_release_info.outputs.upload_url }} | ||
asset_path: ./${{ runner.os }}.zip | ||
asset_name: ${{ steps.get_release_info.outputs.file_name }}-${{ runner.os }}.zip | ||
asset_content_type: application/zip |