Skip to content

Commit

Permalink
Merge pull request #23 from carolynvs/gh-releases
Browse files Browse the repository at this point in the history
Publish to GH
  • Loading branch information
carolynvs authored Apr 8, 2021
2 parents bd52433 + 2a57eff commit 4066658
Show file tree
Hide file tree
Showing 8 changed files with 229 additions and 134 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
bin
.cnab
/build/git_askpass.sh
14 changes: 1 addition & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,7 @@ ifndef HAS_JSONPP
endif

publish: bin/porter$(FILE_EXT)
# AZURE_STORAGE_CONNECTION_STRING will be used for auth in the following commands
if [[ "$(PERMALINK)" == "latest" ]]; then \
az storage blob upload-batch -d porter/mixins/$(MIXIN)/$(VERSION) -s $(BINDIR)/$(VERSION); \
az storage blob upload-batch -d porter/mixins/$(MIXIN)/$(PERMALINK) -s $(BINDIR)/$(VERSION); \
else \
mv $(BINDIR)/$(VERSION) $(BINDIR)/$(PERMALINK); \
az storage blob upload-batch -d porter/mixins/$(MIXIN)/$(PERMALINK) -s $(BINDIR)/$(PERMALINK); \
fi

# Generate the mixin feed
az storage blob download -c porter -n atom.xml -f bin/atom.xml
bin/porter mixins feed generate -d bin/mixins -f bin/atom.xml -t build/atom-template.xml
az storage blob upload -c porter -n atom.xml -f bin/atom.xml
go run mage.go Publish $(MIXIN) $(VERSION) $(PERMALINK)

bin/porter$(FILE_EXT):
curl -fsSLo bin/porter$(FILE_EXT) https://cdn.porter.sh/canary/porter-$(CLIENT_PLATFORM)-$(CLIENT_ARCH)$(FILE_EXT)
Expand Down
6 changes: 4 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ trigger:
branches:
include:
- refs/heads/main
- refs/tags/*
- refs/tags/v*

pool:
vmImage: 'Ubuntu 16.04'
Expand All @@ -33,6 +33,8 @@ steps:
displayName: 'Cross Compile'

- script: |
AZURE_STORAGE_CONNECTION_STRING=$(AZURE_STORAGE_CONNECTION_STRING) make publish
make publish
env:
GITHUB_TOKEN: $(GITHUB_TOKEN)
displayName: 'Publish'
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
38 changes: 6 additions & 32 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,14 @@ module get.porter.sh/mixin/gcloud
go 1.13

require (
get.porter.sh/porter v0.25.0-beta.1
github.com/PaesslerAG/gval v1.0.1
github.com/PaesslerAG/jsonpath v0.1.1
github.com/davecgh/go-spew v1.1.1
get.porter.sh/porter v0.37.2
github.com/PaesslerAG/gval v1.0.1 // indirect
github.com/ghodss/yaml v1.0.0
github.com/gobuffalo/envy v1.7.1
github.com/gobuffalo/genny v0.1.1
github.com/gobuffalo/gogen v0.1.1
github.com/gobuffalo/logger v1.0.1
github.com/gobuffalo/mapi v1.0.2
github.com/gobuffalo/packd v0.3.0
github.com/gobuffalo/packr/v2 v2.7.1
github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754
github.com/inconshreveable/mousetrap v1.0.0
github.com/joho/godotenv v1.3.0
github.com/karrick/godirwalk v1.10.3
github.com/konsorten/go-windows-terminal-sequences v1.0.2
github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2
github.com/markbates/safe v1.0.1
github.com/pkg/errors v0.8.1
github.com/pmezard/go-difflib v1.0.0
github.com/rogpeppe/go-internal v1.4.0
github.com/sirupsen/logrus v1.4.2
github.com/spf13/afero v1.2.2
github.com/spf13/cobra v0.0.5
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.4.0
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415
github.com/gobuffalo/packr/v2 v2.8.0
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v1.0.0
github.com/stretchr/testify v1.6.1
github.com/xeipuuv/gojsonschema v1.2.0
golang.org/x/crypto v0.0.0-20191028145041-f83a4685e152
golang.org/x/sys v0.0.0-20191112214154-59a1497f0cea
golang.org/x/text v0.3.2
golang.org/x/tools v0.0.0-20191014205221-18e3458ac98b
gopkg.in/yaml.v2 v2.2.4
)

Expand Down
268 changes: 184 additions & 84 deletions go.sum

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions mage.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// +build ignore

package main

import (
"os"

"github.com/magefile/mage/mage"
)

// This file allows someone to run mage commands without mage installed
// by running `go run mage.go TARGET`.
// See https://magefile.org/zeroinstall/
func main() { os.Exit(mage.Main()) }
17 changes: 17 additions & 0 deletions magefile.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// +build mage

package main

import (
// mage:import
"get.porter.sh/porter/mage/releases"
)

// We are migrating to mage, but for now keep using make as the main build script interface.

// Publish the cross-compiled binaries.
func Publish(mixin string, version string, permalink string) {
releases.PrepareMixinForPublish(mixin, version, permalink)
releases.PublishMixin(mixin, version, permalink)
releases.PublishMixinFeed(mixin, version)
}
5 changes: 2 additions & 3 deletions pkg/gcloud/execute_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package gcloud
import (
"bytes"
"io/ioutil"
"os"
"path"
"testing"

Expand Down Expand Up @@ -33,12 +32,12 @@ func TestMixin_Execute(t *testing.T) {
"gcloud --quiet compute instances delete myinst --delete-disks all --format json"},
}

defer os.Unsetenv(test.ExpectedCommandEnv)
for _, tc := range testcases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
m := NewTestMixin(t)

os.Setenv(test.ExpectedCommandEnv, tc.wantCommand)
m.Setenv(test.ExpectedCommandEnv, tc.wantCommand)
mixinInputB, err := ioutil.ReadFile(tc.file)
require.NoError(t, err)

Expand Down

0 comments on commit 4066658

Please sign in to comment.