-
Notifications
You must be signed in to change notification settings - Fork 77
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
1 parent
0c5b709
commit b87e1f1
Showing
8 changed files
with
139 additions
and
12 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,36 @@ | ||
--- | ||
name: Release ansible-rulebook | ||
|
||
env: | ||
LC_ALL: "C.UTF-8" # prevent ERROR: Ansible could not initialize the preferred locale: unsupported locale setting | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
stage: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 90 | ||
permissions: | ||
packages: write | ||
contents: write | ||
steps: | ||
- name: Checkout ansible-rulebook | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
fetch-tags: true | ||
|
||
- name: Get python version from Makefile | ||
run: echo py_version=`make PYTHON_VERSION` >> $GITHUB_ENV | ||
|
||
- name: Install python ${{ env.py_version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ env.py_version }} | ||
|
||
- name: Install python deps | ||
run: pip install -r requirements_dev.txt | ||
|
||
- name: Create release | ||
run: ansible-playbook tools/ansible/release.yml -i localhost -e github_token=${{ secrets.GITHUB_TOKEN }} -vvv |
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 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 @@ | ||
1.0.5 |
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 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 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 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,70 @@ | ||
--- | ||
- name: Release ansible-rulebook | ||
hosts: localhost | ||
connection: local | ||
gather_facts: true | ||
vars: | ||
repo_identifier: "ansible/ansible-rulebook" | ||
api_repo_prefix: "https://api.github.com/repos/{{ repo_identifier }}" | ||
|
||
# Note: | ||
# When this playbook runs it will run in the directory of the playbook so ../../ would be a reference to the ansible-rulebook root | ||
|
||
tasks: | ||
|
||
- name: Get the build number from VERSION file | ||
shell: "cat VERSION" | ||
args: | ||
chdir: '../../' | ||
register: version_file | ||
|
||
- set_fact: | ||
release_number: "{{ version_file.stdout }}" | ||
|
||
- name: Build ansible-rulebook | ||
command: | ||
cmd: make dist | ||
args: | ||
chdir: '../../' | ||
tags: | ||
- build | ||
|
||
- name: Create release in github | ||
uri: | ||
url: "{{ api_repo_prefix }}/releases" | ||
method: POST | ||
body_format: json | ||
body: | ||
tag_name: "{{ release_number }}" | ||
name: "v{{ release_number }}" | ||
draft: False | ||
generate_release_notes: True | ||
status_code: | ||
- 201 | ||
headers: | ||
Accept: 'application/vnd.github.v3+json' | ||
Authorization: 'bearer {{ github_token }}' | ||
register: new_release_response | ||
tags: | ||
- github | ||
|
||
- name: Upload the build files | ||
uri: | ||
# For some reason the upload_url ends with ansible-rulebook/releases/138751035/assets{?name,label} | ||
# We have to strip that off before adding our args to the URLs | ||
url: "{{ new_release_response.json['upload_url'] | regex_replace('{.*}', '') }}?name={{ file_name }}" | ||
method: POST | ||
src: "{{ item }}" | ||
status_code: | ||
- 201 | ||
headers: | ||
Accept: 'application/vnd.github.v3+json' | ||
Authorization: 'bearer {{ github_token }}' | ||
Content-Type: "{{ file_name.endswith('tar.gz') | ternary('application/gzip', 'application/x-wheel+zip') }}" | ||
vars: | ||
file_name: "{{ item | basename }}" | ||
loop: "{{ lookup('ansible.builtin.fileglob', '../../dist/*', wantlist=True) }}" | ||
loop_control: | ||
label: "{{ item | basename }}" | ||
tags: | ||
- github |