-
Notifications
You must be signed in to change notification settings - Fork 6
62 lines (59 loc) · 2.09 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
---
# 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 }}