-
Notifications
You must be signed in to change notification settings - Fork 1
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
c0dc9dc
commit 74fb523
Showing
2 changed files
with
84 additions
and
44 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,40 @@ | ||
name: Publish Ansible Galaxy Collection | ||
name: Build and Push Docker Image | ||
|
||
on: | ||
push: | ||
branches: | ||
- main # Ändern Sie dies entsprechend Ihrem Hauptbranch | ||
on: [push] | ||
|
||
jobs: | ||
|
||
uild-and-publish: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
permissions: write-all | ||
|
||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: test | ||
run: | | ||
python ./utils/python/parse_json.py ./plugin_requirements.json | ||
- name: Get current commit ID | ||
run: echo "COMMIT_ID=$(git rev-parse HEAD)" >> $GITHUB_ENV | ||
|
||
- name: Get previous commit ID | ||
run: | | ||
PREV_COMMIT_ID=$(git rev-list --max-parents=0 HEAD | head -n 1) | ||
echo "PREV_COMMIT_ID=$PREV_COMMIT_ID" >> $GITHUB_ENV | ||
- name: Check if requirements have changed | ||
id: check_changes | ||
run: | | ||
# Überprüfen Sie, ob sich plugin_requirements.yml geändert hat | ||
dif= | ||
echo $dif | ||
CHANGED=$(git diff HEAD 'plugin_requirements.yml') | ||
if [ -z "$CHANGED" ]; then | ||
else | ||
echo "CHANGED=false" >> $GITHUB_ENV | ||
fi | ||
- name: Fetch Vault Secret | ||
id: fetch-vault-secret | ||
uses: hashicorp/vault-action@v2 | ||
with: | ||
url: http://localhost:8200 | ||
token: ${{ secrets.VAULT_TOKEN }} | ||
secrets: | | ||
/v1/keyvalue/data/docker/hub pass | DOCKER_HUB_ACCESS_TOKEN ; | ||
/v1/keyvalue/data/docker/hub user | DOCKER_HUB_USERNAME ; | ||
# - name: Build collection | ||
# run: ansible-galaxy collection build -vvv --output-path . --requirements-file requirements.txt --force | ||
# env: | ||
# ANSIBLE_GALAXY_API_KEY: ${{ secrets.GALAXY_API_KEY }} # Stellen Sie sicher, dass GALAXY_API_KEY in Ihren Secrets gesetzt ist | ||
# | ||
# - name: Publish collection | ||
# run: ansible-galaxy collection publish --api-key ${{ secrets.GALAXY_API_KEY }} ./ji_podhead-ilohelper-*.tar.gz | ||
# env: | ||
# ANSIBLE_GALAXY_API_KEY: ${{ secrets.GALAXY_API_KEY }} | ||
- name: Set environment variables | ||
run: | | ||
echo "DOCKER_HUB_USERNAME=${{ steps.fetch-vault-secret.outputs.secrets.DOCKER_HUB_USERNAME }}" >> $GITHUB_ENV | ||
echo "DOCKER_HUB_ACCESS_TOKEN=${{ steps.fetch-vault-secret.outputs.secrets.DOCKER_HUB_ACCESS_TOKEN }}" >> $GITHUB_ENV | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ env.DOCKER_HUB_USERNAME }} | ||
password: ${{ env.DOCKER_HUB_ACCESS_TOKEN }} | ||
|
||
- name: Push Docker Image | ||
uses: docker/push-action@v2 | ||
with: | ||
login-server: docker.io | ||
username: ${{ env.DOCKER_HUB_USERNAME }} | ||
password: ${{ env.DOCKER_HUB_ACCESS_TOKEN }} | ||
tags: user/my-docker-image:latest |
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,53 @@ | ||
name: Publish Ansible Galaxy Collection | ||
|
||
on: | ||
push: | ||
branches: | ||
- main # Ändern Sie dies entsprechend Ihrem Hauptbranch | ||
|
||
jobs: | ||
|
||
uild-and-publish: | ||
runs-on: ubuntu-latest | ||
permissions: write-all | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: test | ||
run: | | ||
python ./utils/python/parse_json.py ./plugin_requirements.json | ||
- name: Get current commit ID | ||
run: echo "COMMIT_ID=$(git rev-parse HEAD)" >> $GITHUB_ENV | ||
|
||
- name: Get previous commit ID | ||
run: | | ||
PREV_COMMIT_ID=$(git rev-list --max-parents=0 HEAD | head -n 1) | ||
echo "PREV_COMMIT_ID=$PREV_COMMIT_ID" >> $GITHUB_ENV | ||
- name: Check if requirements have changed | ||
id: check_changes | ||
run: | | ||
# Überprüfen Sie, ob sich plugin_requirements.yml geändert hat | ||
dif= | ||
echo $dif | ||
CHANGED=$(git diff HEAD 'plugin_requirements.yml') | ||
if [ -z "$CHANGED" ]; then | ||
else | ||
echo "CHANGED=false" >> $GITHUB_ENV | ||
fi | ||
# - name: Build collection | ||
# run: ansible-galaxy collection build -vvv --output-path . --requirements-file requirements.txt --force | ||
# env: | ||
# ANSIBLE_GALAXY_API_KEY: ${{ secrets.GALAXY_API_KEY }} # Stellen Sie sicher, dass GALAXY_API_KEY in Ihren Secrets gesetzt ist | ||
# | ||
# - name: Publish collection | ||
# run: ansible-galaxy collection publish --api-key ${{ secrets.GALAXY_API_KEY }} ./ji_podhead-ilohelper-*.tar.gz | ||
# env: | ||
# ANSIBLE_GALAXY_API_KEY: ${{ secrets.GALAXY_API_KEY }} |