Skip to content

Commit

Permalink
updating release workflow and adding appl silicon builds
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Apr 24, 2024
1 parent c1ec921 commit d3b3281
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 22 deletions.
58 changes: 40 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
file: hadolint

- name: Upload Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: hadolint-Linux-${{steps.build-opts.outputs.arch}}
path: hadolint
Expand All @@ -71,7 +71,7 @@ jobs:
uses: docker/setup-buildx-action@v2

- name: Download Artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: hadolint-Linux-${{matrix.target}}
path: ${{matrix.target}}
Expand Down Expand Up @@ -209,7 +209,8 @@ jobs:
fail-fast: false
matrix:
include:
- os: macos-latest
- os: macos-13
- os: macos-14
- os: windows-latest

steps:
Expand All @@ -226,15 +227,15 @@ jobs:

- name: Setup Haskell
id: setup-haskell-cabal
uses: haskell/actions/setup@v2
uses: haskell-actions/setup@v2
with:
ghc-version: 9.8

- name: Freeze
run: cabal freeze

- name: Cache store
uses: actions/cache@v3.3.1
uses: actions/cache@v4
with:
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
key: ${{ runner.os }}-${{ hashFiles('cabal.project.freeze') }}
Expand All @@ -246,30 +247,41 @@ jobs:
- if: matrix.os == 'windows-latest'
name: Set extension to .exe on Windows
uses: allenevans/set-env@v2.2.0
uses: allenevans/set-env@v3.0.0
with:
EXT: '.exe'

- name: Set binary OS name
uses: allenevans/set-env@v2.2.0
uses: allenevans/set-env@v3.0.0
with:
BINARY_OS: ${{ runner.os }}

- if: matrix.os == 'macos-latest'
- name: Set binary Arch name
uses: allenevans/[email protected]
with:
ARCH: 'x86_64'

- if: (matrix.os == 'macos-13') || (matrix.os == 'macos-14')
name: Set binary OS name on Macos
uses: allenevans/set-env@v2.2.0
uses: allenevans/set-env@v3.0.0
with:
BINARY_OS: 'Darwin'

- if: matrix.os == 'macos-14'
name: Set binary ARCH name for apple silicon
uses: allenevans/[email protected]
with:
ARCH: 'arm64'

- name: Set binary path name
uses: allenevans/set-env@v2.2.0
uses: allenevans/set-env@v3.0.0
with:
BINARY_PATH: ./dist/hadolint${{ env.EXT }}

- name: Upload Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: hadolint-${{ env.BINARY_OS }}-x86_64${{ env.EXT }}
name: hadolint-${{ env.BINARY_OS }}-${{env.ARCH}}${{ env.EXT }}
path: ${{ env.BINARY_PATH }}
retention-days: 3

Expand All @@ -280,28 +292,34 @@ jobs:
steps:

- name: Check out
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Download Linux x86
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: hadolint-Linux-amd64
path: artifacts/hadolint-Linux-x86_64

- name: Download Linux arm64
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: hadolint-Linux-arm64
path: artifacts/hadolint-Linux-arm64

- name: Download Macos x86
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: hadolint-Darwin-x86_64
path: artifacts/hadolint-Darwin-x86_64

- name: Download Macos arm
uses: actions/download-artifact@v4
with:
name: hadolint-Darwin-arm64
path: artifacts/hadolint-Darwin-arm64

- name: Download Windows x86
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: hadolint-Windows-x86_64.exe
path: artifacts/hadolint-Windows-x86_64.exe
Expand All @@ -311,15 +329,17 @@ jobs:
mv artifacts/hadolint-Linux-x86_64/hadolint hadolint-Linux-x86_64
mv artifacts/hadolint-Linux-arm64/hadolint hadolint-Linux-arm64
mv artifacts/hadolint-Darwin-x86_64/hadolint hadolint-Darwin-x86_64
mv artifacts/hadolint-Darwin-arm64/hadolint hadolint-Darwin-arm64
mv artifacts/hadolint-Windows-x86_64.exe/hadolint.exe hadolint-Windows-x86_64.exe
sha256sum -b hadolint-Linux-x86_64 > hadolint-Linux-x86_64.sha256
sha256sum -b hadolint-Linux-arm64 > hadolint-Linux-arm64.sha256
sha256sum -b hadolint-Darwin-x86_64 > hadolint-Darwin-x86_64.sha256
sha256sum -b hadolint-Darwin-arm64 > hadolint-Darwin-arm64.sha256
sha256sum -b hadolint-Windows-x86_64.exe > hadolint-Windows-x86_64.exe.sha256
- name: Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
generate_release_notes: true
Expand All @@ -331,5 +351,7 @@ jobs:
hadolint-Linux-arm64.sha256
hadolint-Darwin-x86_64
hadolint-Darwin-x86_64.sha256
hadolint-Darwin-arm64
hadolint-Darwin-arm64.sha256
hadolint-Windows-x86_64.exe
hadolint-Windows-x86_64.exe.sha256
5 changes: 1 addition & 4 deletions release.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ let
pkgsNative = pkgsNix.native;
pkgsx86_64-static = pkgsNix.x86_64-static;
pkgsAarch64-static = pkgsNix.aarch64-static;
pkgsAarch64-darwin = pkgsNix.aarch64-darwin;

hsApp = {
pkgs ? pkgsNative
Expand Down Expand Up @@ -48,10 +47,8 @@ let
configureFlags = staticFlags pkgsAarch64-static;
};

appAarch64-darwin = hsApp { pkgs = pkgsAarch64-darwin; };
in {
native = appNative.hadolint.components.exes.hadolint;
linux-static = appx86_64-static.hadolint.components.exes.hadolint;
linux-arm-static = appAarch64-static.hadolint.components.exes.hadolint;
darwin-arm = appAarch64-static.hadolint.components.exes.hadolint;
}
}

0 comments on commit d3b3281

Please sign in to comment.