Create v19.3.0.0.0.yml (#66) #27
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
--- | |
# This is a basic workflow to help you get started with Actions | |
name: release | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push or pull request events | |
# but only for the main branch | |
push: | |
branches: [main] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs | |
# that can run sequentially or in parallel | |
jobs: | |
release: | |
env: | |
python_ver: "3.10" | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ansible_collections | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
path: ansible_collections | |
- name: Setup Python v${{ env.python_ver }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ env.python_ver }} | |
cache: 'pip' | |
- name: Install dependencies | |
run: | | |
python -m pip install -U pip | |
python -m pip install -r ci-requirements.txt | |
- name: Prepare environment | |
run: | | |
chmod -v +x ./scripts/* | |
- name: Publish to Galaxy | |
run: | | |
sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 | |
sudo chmod a+x /usr/local/bin/yq | |
yq --version | |
echo $(yq galaxy.yml version) | |
echo $(yq e '.version' galaxy.yml) | |
echo "COLLECTION_VERSION=$(yq e '.version' galaxy.yml)" >> $GITHUB_ENV | |
ansible-galaxy collection build | |
echo "COLLECTION_ARCHIVE=$(ls $PWD/*tar.gz)" >> $GITHUB_ENV | |
#GITHUB_ENV update is only available in subsequent runs | |
export collection_archive=`ls $PWD/*tar.gz` | |
ansible-galaxy collection publish --token "${{ secrets.GALAXY_TOKEN }}" -c -vvv $collection_archive | |
- name: Create GitHub Release | |
uses: marvinpinto/action-automatic-releases@latest | |
with: | |
automatic_release_tag: ${{ env.COLLECTION_VERSION }} | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
prerelease: false | |
files: | | |
${{ env.COLLECTION_ARCHIVE }} |