-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(pipelines): automatic releases and publishing (#34)
- Loading branch information
Showing
8 changed files
with
242 additions
and
5 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,6 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" |
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,48 @@ | ||
name: Merge into main branch | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
|
||
jobs: | ||
prepare: | ||
name: Calculate Version | ||
runs-on: ubuntu-20.04 | ||
|
||
outputs: | ||
new_release: ${{ steps.semantic.outputs.new_release_published }} | ||
release: ${{ steps.semantic.outputs.new_release_version }} | ||
release_notes: ${{ steps.semantic.outputs.new_release_notes }} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
token: ${{ secrets.ACCESS_TOKEN }} | ||
|
||
- uses: cycjimmy/semantic-release-action@v2 | ||
id: semantic | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | ||
with: | ||
dry_run: true | ||
|
||
prerelease: | ||
if: needs.prepare.outputs.new_release == 'true' | ||
|
||
name: Create Pre-Release | ||
runs-on: ubuntu-20.04 | ||
|
||
needs: prepare | ||
|
||
steps: | ||
- uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | ||
VERSION: ${{ needs.prepare.outputs.release }} | ||
with: | ||
tag_name: ${{ env.VERSION }} | ||
release_name: ${{ env.VERSION }} | ||
body: ${{ needs.prepare.outputs.release_notes }} | ||
draft: false | ||
prerelease: true | ||
|
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,83 @@ | ||
name: prerelease | ||
|
||
on: | ||
release: | ||
types: [ prereleased ] | ||
|
||
jobs: | ||
package: | ||
name: Build and Package | ||
runs-on: ubuntu-20.04 | ||
|
||
outputs: | ||
version: ${{ steps.version.outputs.value }} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Version | ||
id: version | ||
run: echo ::set-output name=value::$(cat VERSION) | ||
|
||
- name: Setup Python 3.7 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.7' | ||
|
||
- name: Cache pip | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
${{ runner.os }}- | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install wheel | ||
- name: Build package | ||
run: make package version=${{ steps.version.outputs.value }} | ||
|
||
- name: Upload Pipeline Artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: built-artifacts | ||
path: dist/ | ||
|
||
upload-assets: | ||
name: Upload Assets to Release | ||
runs-on: ubuntu-20.04 | ||
|
||
needs: package | ||
|
||
steps: | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: built-artifacts | ||
path: dist/ | ||
|
||
- uses: AButler/upload-release-assets@v2.0 | ||
with: | ||
files: 'dist/*' | ||
repo-token: ${{ secrets.ACCESS_TOKEN }} | ||
release-tag: ${{ needs.package.outputs.version }} | ||
|
||
publish-pypi: | ||
name: Publish packages to PyPi | ||
runs-on: ubuntu-20.04 | ||
|
||
needs: package | ||
|
||
steps: | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: built-artifacts | ||
path: dist/ | ||
|
||
- uses: pypa/gh-action-pypi-publish@v1.4.1 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} |
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,38 @@ | ||
name: pull request | ||
|
||
on: | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
validate: | ||
name: Validate | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Setup Python 3.7 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.7' | ||
|
||
- name: Cache pip | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
${{ runner.os }}- | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install wheel | ||
- name: Lint | ||
run: make lint || exit 0 | ||
|
||
- name: Tests | ||
run: make test || exit 0 |
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,7 @@ | ||
{ | ||
"tagFormat": "${version}", | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator" | ||
] | ||
} |
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,9 @@ | ||
include *.txt | ||
include *.md | ||
include LICENSE | ||
include VERSION | ||
|
||
exclude .gitignore | ||
exclude .releaserc.json | ||
exclude .dvcignore | ||
exclude .dvc |
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,35 @@ | ||
PYTHON = python3.7 | ||
PIP = pip3.7 | ||
|
||
.PHONY: help lint test package clean install | ||
|
||
help: # The following lines will print the available commands when entering just 'make' | ||
ifeq ($(UNAME), Linux) | ||
@grep -P '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | \ | ||
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' | ||
else | ||
@awk -F ':.*###' '$$0 ~ FS {printf "%15s%s\n", $$1 ":", $$2}' \ | ||
$(MAKEFILE_LIST) | grep -v '@awk' | sort | ||
endif | ||
|
||
lint: ### Validates project with linting rules | ||
$(PIP) install pylint | ||
$(PYTHON) -m pylint src/ | ||
|
||
test: ### Runs all the project tests | ||
"Run tests" | ||
$(PIP) install pytest | ||
$(PYTHON) -m pytest tests/ | ||
|
||
package: clean ### Runs the project setup | ||
echo "$(version)" > VERSION | ||
$(PYTHON) setup.py sdist bdist_wheel | ||
|
||
clean: ### Removes build binaries | ||
rm -rf build dist | ||
|
||
install: ### Installs required dependencies | ||
$(PIP) install dist/ydata-synthetic-$(version).tar.gz | ||
|
||
|
||
|
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