List Latest FortiOS Image IDs #8
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
name: List Latest FortiOS Image IDs | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * *' # Run every day at midnight | |
jobs: | |
list_latest_versions: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.x # Specify the version of Python you want to use | |
- name: Install jq | |
run: sudo apt-get install jq | |
- name: Get latest FortiOS version | |
id: get_latest_version | |
run: | | |
LATEST_VERSION=$(curl -s https://marketplace.fortinet.com/api/v1/products/fortios\?limit\=1 | jq -r '.results[0].latest_version') | |
echo "Latest FortiOS Version: $LATEST_VERSION" | |
echo "::set-output name=latest_version::$LATEST_VERSION" | |
list_image_ids: | |
needs: list_latest_versions | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up AWS CLI | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 # Specify your AWS region | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.x # Specify the version of Python you want to use | |
- name: Run Bash script for the latest version | |
run: | | |
LATEST_VERSION=$1 | |
if [[ -z "$LATEST_VERSION" ]]; then | |
echo "Failed to get the latest version. Exiting..." | |
exit 1 | |
fi | |
# Rest of your Bash script here | |
echo "Running the script for FortiOS version: $LATEST_VERSION" | |
# ... your script logic ... | |
env: | |
LATEST_VERSION: ${{ needs.get_latest_version.outputs.latest_version }} |