forked from galaxyproject/ansible-galaxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/artbio/ansible-galaxy into …
…main
- Loading branch information
Showing
22 changed files
with
567 additions
and
59 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
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 |
---|---|---|
|
@@ -16,50 +16,57 @@ name: "Automatic Regular Releases" | |
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 0 * * 1' | ||
- cron: '0 0 * * 1' | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the codebase. | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Python 3. | ||
uses: actions/setup-python@v2 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Install Ansible. | ||
run: pip3 install ansible-base | ||
run: pip3 install six ansible-base | ||
|
||
- name: Check for changes | ||
run: | | ||
MOST_RECENT_TAG=$(git describe --tags --abbrev=0) | ||
CHANGES=$(git diff ${MOST_RECENT_TAG} --name-only | wc -l) | ||
echo "Found ${CHANGES} files" | ||
git diff ${MOST_RECENT_TAG} --name-only | ||
LATEST_TAG=$(git describe --tags --abbrev=0) | ||
echo "The last released tag was ${LATEST_TAG}" | ||
CHANGES=$(git diff ${LATEST_TAG} --name-only | wc -l) | ||
echo "Found ${CHANGES} changed files" | ||
git diff ${LATEST_TAG} --name-only | ||
echo "changed_files=${CHANGES}" >> $GITHUB_ENV | ||
- name: Create a new git tag | ||
run: | | ||
MOST_RECENT_TAG=$(git describe --tags --abbrev=0) | ||
major_minor=$(echo "$MOST_RECENT_TAG" | sed 's/\(.*\..*\.\)\(.*\)/\1/') | ||
patch=$(echo "$MOST_RECENT_TAG" | sed 's/\(.*\..*\.\)\(.*\)/\2/') | ||
LATEST_TAG=$(git describe --tags --abbrev=0) | ||
major_minor=$(echo "$LATEST_TAG" | sed 's/\(.*\..*\.\)\(.*\)/\1/') | ||
patch=$(echo "$LATEST_TAG" | sed 's/\(.*\..*\.\)\(.*\)/\2/') | ||
newpatch=$(echo "$patch + 1" | bc) | ||
NEW_TAG="${major_minor}${newpatch}" | ||
echo "$MOST_RECENT_TAG -> $NEW_TAG" | ||
echo "$LATEST_TAG -> $NEW_TAG" | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
git tag "$NEW_TAG" | ||
git push --tags | ||
echo "Creating new tag $NEW_TAG" >> $GITHUB_STEP_SUMMARY | ||
if: env.changed_files > 0 | ||
|
||
# We have to do this step as GHA prevents triggering it's own actions, to prevent runaway loops. | ||
# We have to do this step as GHA prevents triggering it's own actions, to | ||
# prevent runaway loops. | ||
- name: Trigger a new import on Galaxy. | ||
run: ansible-galaxy role import --api-key ${{ secrets.GALAXY_API_KEY }} $(echo ${{ github.repository }} | cut -d/ -f1) $(echo ${{ github.repository }} | cut -d/ -f2) --branch main | ||
run: | | ||
org=$(echo ${{ github.repository }} | cut -d/ -f1) | ||
repo=$(echo ${{ github.repository }} | cut -d/ -f2) | ||
key=${{ secrets.GALAXY_API_KEY }} | ||
ansible-galaxy role import --api-key $key $org $repo --branch main | ||
if: env.changed_files > 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
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
Oops, something went wrong.