Skip to content
This repository was archived by the owner on Nov 2, 2021. It is now read-only.

Commit 692b3cc

Browse files
committed
Default to go 1.13 and bump minor version
1 parent 44be714 commit 692b3cc

File tree

7 files changed

+94
-12
lines changed

7 files changed

+94
-12
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
FROM golang:1.12
1+
FROM golang:1.13
22

33
LABEL name="Golang Action"
44
LABEL maintainer="Cedric Kring"
5-
LABEL version="1.3.0"
5+
LABEL version="1.4.0"
66
LABEL repository="https://github.com/cedrickring/golang-action"
77

88
LABEL com.github.actions.name="Golang Action"

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- uses: actions/checkout@master
1919

2020
- name: run
21-
uses: cedrickring/golang-action@1.3.0
21+
uses: cedrickring/golang-action@1.4.0
2222
```
2323
2424
@@ -27,7 +27,7 @@ To run a custom command, just use:
2727
```yaml
2828
steps:
2929
- name: Run custom command
30-
uses: cedrickring/golang-action@1.3.0
30+
uses: cedrickring/golang-action@1.4.0
3131
with:
3232
args: make my-target
3333
```
@@ -39,7 +39,7 @@ source Go project:
3939
```yaml
4040
steps:
4141
- name: Run with custom import path
42-
uses: cedrickring/golang-action@1.3.0
42+
uses: cedrickring/golang-action@1.4.0
4343
env:
4444
IMPORT: "root/repo"
4545
```
@@ -49,7 +49,7 @@ To use Go Modules add `GO111MODULE=on` to the step:
4949
```yaml
5050
steps:
5151
- name: Go Modules
52-
uses: cedrickring/golang-action@1.3.0
52+
uses: cedrickring/golang-action@1.4.0
5353
env:
5454
GO111MODULE: "on"
5555
```
@@ -59,14 +59,14 @@ If your go project is not located at the root of the repo you can also specify e
5959
```yaml
6060
steps:
6161
- name: Custom project path
62-
uses: cedrickring/golang-action@1.3.0
62+
uses: cedrickring/golang-action@1.4.0
6363
env:
6464
PROJECT_PATH: "./path/in/my/project"
6565
```
6666

67-
To use a specific golang version (1.10, 1.11, 1.12):
67+
To use a specific golang version (1.10, 1.11, 1.12, 1.13), defaults to the latest version:
6868
```yaml
6969
steps:
7070
- name: Use Go 1.11
71-
uses: cedrickring/golang-action/go1.11@1.3.0
71+
uses: cedrickring/golang-action/go1.11@1.4.0
7272
```

go1.10/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM golang:1.10
22

33
LABEL name="Golang Action"
44
LABEL maintainer="Cedric Kring"
5-
LABEL version="1.3.0"
5+
LABEL version="1.4.0"
66
LABEL repository="https://github.com/cedrickring/golang-action"
77

88
LABEL com.github.actions.name="Golang Action"

go1.11/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM golang:1.11
22

33
LABEL name="Golang Action"
44
LABEL maintainer="Cedric Kring"
5-
LABEL version="1.3.0"
5+
LABEL version="1.4.0"
66
LABEL repository="https://github.com/cedrickring/golang-action"
77

88
LABEL com.github.actions.name="Golang Action"

go1.12/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM golang:1.12
22

33
LABEL name="Golang Action"
44
LABEL maintainer="Cedric Kring"
5-
LABEL version="1.3.0"
5+
LABEL version="1.4.0"
66
LABEL repository="https://github.com/cedrickring/golang-action"
77

88
LABEL com.github.actions.name="Golang Action"

go1.13/Dockerfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
FROM golang:1.13
2+
3+
LABEL name="Golang Action"
4+
LABEL maintainer="Cedric Kring"
5+
LABEL version="1.4.0"
6+
LABEL repository="https://github.com/cedrickring/golang-action"
7+
8+
LABEL com.github.actions.name="Golang Action"
9+
LABEL com.github.actions.description="Run Golang commands"
10+
LABEL com.github.actions.icon="box"
11+
LABEL com.github.actions.color="blue"
12+
13+
# Install dep and check sha256 checksum matches for version 0.5.0 https://github.com/golang/dep/releases/tag/v0.5.0
14+
RUN set -eux; \
15+
curl -L -s https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64 -o "$GOPATH/bin/dep"; \
16+
echo "287b08291e14f1fae8ba44374b26a2b12eb941af3497ed0ca649253e21ba2f83 $GOPATH/bin/dep" | sha256sum -c -; \
17+
chmod +x "${GOPATH}/bin/dep";
18+
19+
COPY entrypoint.sh /entrypoint.sh
20+
21+
ENTRYPOINT ["/entrypoint.sh"]
22+
CMD [""]

go1.13/entrypoint.sh

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
if [ -z "${IMPORT}" ]; then
6+
IMPORT="${GITHUB_REPOSITORY}"
7+
fi
8+
WORKDIR="${GOPATH}/src/github.com/${IMPORT}"
9+
10+
# PROJECT_PATH specifies the subdirectory in the working directory that the Go project is
11+
if [ -z "${PROJECT_PATH}" ]; then
12+
PROJECT_PATH="."
13+
fi
14+
15+
# Go can only find dependencies if they're under $GOPATH/src.
16+
# GitHub Actions mounts your repository outside of $GOPATH.
17+
# So symlink the repository into $GOPATH, and then cd to it.
18+
mkdir -p "$(dirname "${WORKDIR}")"
19+
ln -s "${PWD}" "${WORKDIR}"
20+
cd "${WORKDIR}/${PROJECT_PATH}"
21+
22+
# If a command was specified with `args="..."`, then run it. Otherwise,
23+
# look for something useful to run.
24+
if [ $# -eq 0 ] || [ "$*" = "" ]; then
25+
if [ -r Makefile ]; then
26+
make
27+
else
28+
if [ -r go.mod ]; then
29+
export GO111MODULE=on
30+
# Check if using vendored dependencies
31+
if [ -d "vendor" ]; then
32+
export GOFLAGS="-mod=vendor"
33+
else
34+
# Ensure no go.mod changes are made that weren't committed
35+
export GOFLAGS="-mod=readonly"
36+
fi
37+
else
38+
if [ -r Gopkg.toml ]; then
39+
# Check if using vendored dependencies
40+
if [ -d "vendor" ]; then
41+
# Check that dep is in sync with /vendor dependencies and that running dep ensure doesn't result in modifications to Gopkg.lock/Gopkg.toml
42+
"$GOPATH/bin/dep" ensure && "$GOPATH/bin/dep" check
43+
git_workspace_status="$(git status --porcelain)"
44+
if [ -n "${git_workspace_status}" ]; then
45+
echo "Unexpected changes were found in dep /vendored. Please run $(dep ensure) and commit changes:";
46+
echo "${git_workspace_status}";
47+
exit 1;
48+
fi
49+
else
50+
# Run dep ensure to download and sync dependencies
51+
"$GOPATH/bin/dep" ensure
52+
fi
53+
fi
54+
fi
55+
go build ./...
56+
go test ./...
57+
fi
58+
else
59+
sh -c "$*"
60+
fi

0 commit comments

Comments
 (0)