Fix the example command. #2
Workflow file for this run
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
on: | |
push: | |
# Sequence of patterns matched against refs/tags | |
tags: | |
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | |
name: Create Release | |
jobs: | |
build: | |
name: Create Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Retrieve version and Changelog | |
run: | | |
echo ICLOUDPD_VERSION=$(cat setup.py | grep version= | cut -d'"' -f 2) >> $GITHUB_ENV | |
echo "::debug::${{env.ICLOUDPD_VERSION}}" | |
echo 'ICLOUDPD_CHANGELOG<<EOF' >> $GITHUB_ENV | |
scripts/extract_releasenotes CHANGELOG.md >> $GITHUB_ENV | |
echo 'EOF' >> $GITHUB_ENV | |
echo "::debug::${{env.ICLOUDPD_CHANGELOG}}" | |
- name: Install dependencies | |
# check if the tag matches the version in setup.py | |
if: endsWith(github.ref, env.ICLOUDPD_VERSION) | |
run: | | |
python3 -m pip install --upgrade pip | |
python3 -m pip install setuptools | |
# this section should be updated. p.e. wheel is installed too late. | |
# this leads to unnecessary warnings | |
scripts/install_deps | |
- name: Build and publish | |
if: endsWith(github.ref, env.ICLOUDPD_VERSION) | |
env: | |
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
run: | | |
python3 setup.py bdist_wheel --universal | |
echo ICLOUDPD_ASSET_PATH=$(find dist -name '*whl') >> $GITHUB_ENV | |
echo "::debug::${{env.ICLOUDPD_ASSET_PATH}}" | |
echo ICLOUDPD_ASSET_NAME=$(basename $(find dist -name '*whl')) >> $GITHUB_ENV | |
# Variable not read correctly?! | |
#echo ICLOUDPD_ASSET_NAME=$(basename ${{env.ICLOUDPD_ASSET_PATH}}) >> $GITHUB_ENV | |
echo "::debug::${{env.ICLOUDPD_ASSET_NAME}}" | |
python3 -m twine upload dist/* | |
#python3 -m twine upload --repository testpypi dist/* | |
# todo: put repo in github secret for flexibility | |
- name: Create Release | |
if: endsWith(github.ref, env.ICLOUDPD_VERSION) | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
body: ${{ env.ICLOUDPD_CHANGELOG }} | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
if: endsWith(github.ref, env.ICLOUDPD_VERSION) | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
asset_path: ${{env.ICLOUDPD_ASSET_PATH}} | |
asset_name: ${{env.ICLOUDPD_ASSET_NAME}} | |
asset_content_type: application/zip | |
- name: Set up QEMU | |
if: endsWith(github.ref, env.ICLOUDPD_VERSION) | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildx | |
if: endsWith(github.ref, env.ICLOUDPD_VERSION) | |
uses: docker/setup-buildx-action@v1 | |
- | |
name: Builder instance name | |
run: echo ${{ steps.buildx.outputs.name }} | |
- | |
name: Available platforms | |
run: echo ${{ steps.buildx.outputs.platforms }} | |
- name: Login to DockerHub | |
if: endsWith(github.ref, env.ICLOUDPD_VERSION) | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Build and push | |
if: endsWith(github.ref, env.ICLOUDPD_VERSION) | |
env: | |
ICLOUDPD_VERSION: ${{env.ICLOUDPD_VERSION}} | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: ./Dockerfile.release | |
platforms: linux/amd64,linux/arm64,linux/386 | |
push: true | |
tags: | | |
icloudpd/icloudpd:latest | |
icloudpd/icloudpd:${{env.ICLOUDPD_VERSION}} | |
build-args: | | |
ICLOUDPD_VERSION=${{env.ICLOUDPD_VERSION}} |