Skip to content

Commit 4240bd7

Browse files
authored
action: add Windows support for Atlas GitHub Action (#6)
* action: add Windows support for Atlas GitHub Action * fix: allow using version when using windows * test: run setup atlas with latest and specific version * chore: fix typo * chore: simplify the logic
1 parent d52cd13 commit 4240bd7

File tree

2 files changed

+42
-6
lines changed

2 files changed

+42
-6
lines changed

.github/workflows/setup_atlas.yml

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,37 @@
11
name: Setup Atlas
22
run-name: I'm using Atlas 🚀
3-
on: [push]
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
410
jobs:
5-
use-atlas:
6-
runs-on: ubuntu-latest
11+
test-versions:
12+
strategy:
13+
matrix:
14+
os: [ubuntu-latest, windows-latest, macos-latest]
15+
runs-on: ${{ matrix.os }}
716
steps:
817
- uses: actions/checkout@v4
9-
- uses: ./
10-
- run: atlas version
18+
- name: Install Latest Atlas
19+
uses: ./
20+
- name: Get Atlas Version
21+
id: atlas-version
22+
shell: bash
23+
run: |
24+
VERSION=$(atlas version | awk '{print $3}')
25+
echo "version=$VERSION" >> $GITHUB_OUTPUT
26+
- name: Install Specific Version
27+
uses: ./
28+
with:
29+
version: ${{ steps.atlas-version.outputs.version }}
30+
- name: Verify Version
31+
shell: bash
32+
run: |
33+
INSTALLED_VERSION=$(atlas version | awk '{print $3}')
34+
if [ "$INSTALLED_VERSION" != "${{ steps.atlas-version.outputs.version }}" ]; then
35+
echo "Version mismatch: expected ${{ steps.atlas-version.outputs.version }}, got $INSTALLED_VERSION"
36+
exit 1
37+
fi

action.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,17 @@ inputs:
1515
runs:
1616
using: "composite"
1717
steps:
18-
- run: curl -sSf https://atlasgo.sh | ATLAS_VERSION=${{inputs.version}} CI=true sh
18+
- if: runner.os != 'Windows'
1919
shell: bash
20+
run: curl -sSf https://atlasgo.sh | ATLAS_VERSION=${{inputs.version}} CI=true sh
21+
- if: runner.os == 'Windows'
22+
shell: pwsh
23+
run: |
24+
$url = "https://release.ariga.io/atlas/atlas-windows-amd64-${{ inputs.version }}.exe"
25+
$targetPath = "$env:LocalAppData\Programs\Atlas"
26+
New-Item -Path $targetPath -ItemType Directory -Force
27+
curl -L $url -o "$targetPath\atlas.exe"
28+
Add-Content $env:GITHUB_PATH "$targetPath"
2029
- name: Login to Atlas
2130
if: inputs.cloud-token != null
2231
shell: bash

0 commit comments

Comments
 (0)