fix using force push #7
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: Update Dependency | |
on: | |
push: | |
branches: | |
- '**' # Trigger on commits to any branch | |
jobs: | |
update-dependency: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up jq | |
run: sudo apt-get install jq | |
- name: Fetch latest version of dependency | |
id: fetch_version | |
run: | | |
# Fetch the latest version from the FirelyTeam/firely-terminal-pipeline GitHub repository | |
LATEST_VERSION=$(curl -s https://api.github.com/repos/FirelyTeam/firely-terminal-pipeline/releases/latest | jq -r .tag_name) | |
echo "LATEST_VERSION=$LATEST_VERSION" >> $GITHUB_ENV | |
- name: Update PR template version | |
run: | | |
# Update the version in PR_Template_VersionUpgrade.md | |
sed -i "s/Version:.*/Version: $LATEST_VERSION/" .github/PULL_REQUEST_TEMPLATE/PR_Template_VersionUpgrade.md | |
- name: Update main.yml | |
run: | | |
# Update the main.yml file with the new version | |
sed -i "s|uses: FirelyTeam/firely-terminal-pipeline@.*|uses: FirelyTeam/firely-terminal-pipeline@$LATEST_VERSION|" .github/workflows/main.yml | |
- name: Commit changes | |
run: | | |
# Commit and push the changes to a new branch | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git checkout -b update-dependency-$LATEST_VERSION || git checkout update-dependency-$LATEST_VERSION | |
git add .github/PULL_REQUEST_TEMPLATE/PR_Template_VersionUpgrade.md .github/workflows/main.yml | |
git commit -m "Update dependency to version $LATEST_VERSION" | |
git push -f origin update-dependency-$LATEST_VERSION |