Progress transfer script to workflow #207
Workflow file for this run
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: Post Publish | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
release-tag: | ||
type: string | ||
description: 'Semver release tag e.g. v1.1.0' | ||
required: true | ||
workflow_run: | ||
workflows: [Release] | ||
types: | ||
- completed | ||
jobs: | ||
on-success-or-workflow-dispatch: | ||
runs-on: ubuntu-latest | ||
if: github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' | ||
outputs: | ||
release-tag: ${{ steps.release-tag.outputs.tag }} | ||
steps: | ||
- if: github.event_name == 'workflow_run' | ||
name: Download Artifact from Release workflow | ||
uses: dawidd6/action-download-artifact@bf251b5aa9c2f7eeb574a96ee720e24f801b7c11 # v6 | ||
with: | ||
workflow: release.yml | ||
name: release-tag | ||
- name: Output Release Tag | ||
id: release-tag | ||
run: | | ||
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | ||
echo "tag=${{ github.event.inputs.release-tag }}" >> "$GITHUB_OUTPUT" | ||
else | ||
value=`cat release-tag.data` | ||
echo "tag=$value" >> "$GITHUB_OUTPUT" | ||
fi | ||
tidy-jira: | ||
needs: [on-success-or-workflow-dispatch] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Tidy Jira | ||
uses: breathingdust/github-jira-tidy@b503407f09af5564fd806924bdf4495510d848b6 # v0.10.0 | ||
with: | ||
jira_host: 'hashicorp.atlassian.net' | ||
jira_username: 'sdavis@hashicorp.com' | ||
jira_password: ${{ secrets.jira_password }} | ||
jira_jql_filter: ${{ secrets.jira_jql_filter }} | ||
jira_github_url_field_id: 'cf[10089]' | ||
github_release_name: ${{ needs.on-success-or-workflow-dispatch.outputs.release-tag }} | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
on-failure: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.workflow_run.conclusion == 'failure' }} | ||
steps: | ||
- run: echo 'The triggering workflow failed' | ||
registry-check: | ||
# strategy: | ||
# matrix: | ||
# os: [ubuntu-latest, windows-latest, macOS-latest] | ||
# runs-on: ${{ matrix.os }} | ||
# runs-on: ubuntu-latest | ||
runs: | ||
using: "composite" | ||
steps: | ||
- using: composite | ||
- name: Registry Version Check | ||
id: registry_latest_ver | ||
shell: bash | ||
run: | | ||
curl -s "https://registry.terraform.io/v2/providers/323/provider-versions/latest" | jq '.data.attributes.version' >> "$GITHUB_OUTPUT" | ||
- name: Check Version Values | ||
if: ${{ needs.on-success-or-workflow-dispatch.outputs.release-tag }} == steps.registry_latest_ver.outputs.current | ||
shell: bash | ||
run: | | ||
echo "Latest AWS Terraform Provider version: ${{ needs.on-success-or-workflow-dispatch.outputs.release-tag }}" | ||
- name: Create TF Configuration | ||
shell: bash | ||
run: | | ||
echo "Setting provider version in Terraform configuration..." | ||
cat <<EOF > main.tf | ||
terraform { | ||
required_providers { | ||
aws = { | ||
source = "${PROVIDER}" | ||
version = ${LATEST_VERSION} | ||
} | ||
} | ||
} | ||
provider "aws" { | ||
region = "us-east-1" # Change this to your preferred region | ||
} | ||
EOF | ||
echo "Terraform configuration file (main.tf) created with the latest version." | ||
echo "Initializing Terraform and pulling the latest AWS provider..." | ||
terraform init | ||
# Trigger slack notifications | ||