reusable workflow for linux integrations #1240
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: Install Script Integration Test | |
on: | |
pull_request: | |
branches: [ main ] | |
jobs: | |
install: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
permissions: | |
actions: read | |
contents: read | |
deployments: read | |
packages: none | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get Draft Cli version | |
uses: actions/github-script@v7 | |
id: get_draft_version | |
with: | |
result-encoding: string | |
retries : 3 | |
script: | | |
const tag_url = context.payload.repository.releases_url.replace('{/id}', '/latest'); | |
const response = await github.request(tag_url); | |
return response.data.tag_name; | |
- name: Run Install Script | |
shell: bash | |
run: ./scripts/install.sh | |
env: | |
DRAFT_CLI_VERSION: ${{ steps.get_draft_version.outputs.result }} | |
- name: Validate Command is Installed | |
shell: bash | |
run: | | |
if command -v /home/runner/.local/bin/draft &> /dev/null | |
then | |
echo "install_dir=/home/runner/.local/bin/draft" >> $GITHUB_ENV | |
elif command -v /usr/local/bin/draft &> /dev/null | |
then | |
echo "install_dir=/usr/local/bin/draft" >> $GITHUB_ENV | |
elif command -v /c/Users/runneradmin/.local/bin/draft &> /dev/null | |
then | |
echo "install_dir=/c/Users/runneradmin/.local/bin/draft" >> $GITHUB_ENV | |
elif command -v /Users/runner/.local/bin/draft &> /dev/null | |
then | |
echo "install_dir=/Users/runner/.local/bin/draft" >> $GITHUB_ENV | |
else | |
echo "draft could not be found" | |
exit 1 | |
fi | |
- name: Validate Draft Command Runs | |
shell: bash | |
run: ${{ env.install_dir }} -h |