Skip to content

Commit

Permalink
Add Windows support (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
superbrothers authored Jul 21, 2020
1 parent 0b932ed commit 7bcac53
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 24 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: CI

on:
push:
branches: [master]
tags: ["v*"]
paths-ignore: ['**.md']
pull_request:
types: [opened, synchronize]
paths-ignore: ['**.md']

jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: "~1.13.10"
- name: Ensure go.mod is already tidied
run: go mod tidy && git diff -s --exit-code go.sum
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- run: go get github.com/mitchellh/gox
- run: make test archives test-archive
- name: Create a new release
if: contains(github.ref, 'tags')
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false
- name: Upload binaries to the new release
if: contains(github.ref, 'tags')
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: out/*
tag: ${{ github.ref }}
overwrite: true
file_glob: true
create-pr:
needs: [run]
if: contains(github.ref, 'tags')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
repository: kubernetes-sigs/krew-index
- run: |
git fetch --unshallow
git remote set-url origin https://${{ secrets.GH_PAT }}:[email protected]/superbrothers/krew-index.git
- run: echo ::set-env name=GIT_TAG::${GITHUB_REF##*/}
- name: Download the released krew plugin manifest file
run: |
curl -sLo plugins/sort-manifests.yaml https://github.com/superbrothers/kubectl-sort-manifests-plugin/releases/download/${{ env.GIT_TAG }}/sort-manifests.yaml
git --no-pager diff
- uses: peter-evans/create-pull-request@v2
with:
token: ${{ secrets.GH_PAT }}
committer: Kazuki Suda <[email protected]>
author: Kazuki Suda <[email protected]>
commit-message: Bump the version of sort-manifests to ${{ env.GIT_TAG }}
title: Bump the version of sort-manifests to ${{ env.GIT_TAG }}
body: This PR bumps up the version of sort-manifests to ${{ env.GIT_TAG }}.
branch: sort-manifests-${{ env.GIT_TAG }}
equest-to-parent: true
23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

1 change: 1 addition & 0 deletions hack/make-archives.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ git_tag="${TRAVIS_TAG:-$(git describe --tags --dirty --always)}"
sed -i \
-e "s/KSORT_DARWIN_ZIP_CHECKSUM/$(cat out/ksort-darwin-amd64.zip.sha256)/g" \
-e "s/KSORT_LINUX_ZIP_CHECKSUM/$(cat out/ksort-linux-amd64.zip.sha256)/g" \
-e "s/KSORT_WINDOWS_ZIP_CHECKSUM/$(cat out/ksort-windows-amd64.zip.sha256)/g" \
-e "s/KSORT_VERSION/${git_tag}/g" \
out/sort-manifests.yaml
echo "Written out/sort-manifests.yaml" >&2
Expand Down
2 changes: 1 addition & 1 deletion hack/make-binaries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set -e -o pipefail
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "${SCRIPTDIR}/.."

DEFAULT_OSARCH="darwin/amd64 linux/amd64"
DEFAULT_OSARCH="darwin/amd64 linux/amd64 windows/amd64"
version_pkg="github.com/superbrothers/ksort"

rm -rf out/
Expand Down
12 changes: 12 additions & 0 deletions hack/sort-manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,15 @@ spec:
matchLabels:
os: linux
arch: amd64
- uri: https://github.com/superbrothers/ksort/releases/download/KSORT_VERSION/ksort-windows-amd64.zip
sha256: KSORT_WINDOWS_ZIP_CHECKSUM
bin: ksort.exe
files:
- from: ksort.exe
to: .
- from: LICENSE.txt
to: .
selector:
matchLabels:
os: windows
arch: amd64

0 comments on commit 7bcac53

Please sign in to comment.