Multi arch build & Version bump (#185)

* Upgrading versions

* mod tidy

* LInting

* Linting

* Update action.yaml

* [skip ci] Reverting test changes

* msc chnages

* Update Makefile

* Update README.md

* Update README.md

* Update README.md

* Update Makefile

* [skip ci] Update README.md

* cosmetic changes
This commit is contained in:
Sunny 2025-06-13 19:16:46 +05:30 committed by GitHub
parent a1f96b91e2
commit 3441ed44b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 40 additions and 26 deletions

View file

@ -1,4 +1,4 @@
FROM golang:1.17 AS builder
FROM golang:1.24 AS builder
COPY . /var/app
WORKDIR /var/app
RUN go mod tidy

View file

@ -1,5 +1,5 @@
IMAGE_REPO=ghcr.io/trstringer/manual-approval
TARGET_PLATFORM=linux/amd64
TARGET_PLATFORM=linux/amd64,linux/arm64,linux/arm/v8
.PHONY: tidy
tidy:
@ -11,15 +11,18 @@ build:
echo "VERSION is required"; \
exit 1; \
fi
docker build --platform $(TARGET_PLATFORM) -t $(IMAGE_REPO):$$VERSION .
docker build -t $(IMAGE_REPO):$(VERSION) .
.PHONY: push
.PHONY: build_push
push:
@if [ -z "$(VERSION)" ]; then \
echo "VERSION is required"; \
exit 1; \
fi
docker push $(IMAGE_REPO):$(VERSION)
docker buildx create --use --name mybuilder
docker buildx build --push --platform $(TARGET_PLATFORM) -t $(IMAGE_REPO):$(VERSION) .
docker buildx rm mybuilder
.PHONY: test
test:
@ -27,4 +30,4 @@ test:
.PHONY: lint
lint:
docker run --rm -v $$(pwd):/app -w /app golangci/golangci-lint:v1.46.2 golangci-lint run -v
docker run --rm -v $$(pwd):/app -w /app golangci/golangci-lint:v2.1.6 golangci-lint run -v

View file

@ -23,6 +23,15 @@ These are case insensitive with optional punctuation either a period or an excla
In all cases, `manual-approval` will close the initial GitHub issue.
🖥️ Supported Runners, The action is compatible with the following runner types:
- Linux/amd64 — 64-bit Intel/AMD (x86_64)
- Linux/arm64 — 64-bit ARM (Apple M1)
- Linux/arm/v8 — 64-bit ARM
🚫 Unsupported
- Windows/amd64 — 64-bit Windows systems are currently not supported.
- Non-Linux runners of any architecture.
## Usage
```yaml
@ -108,7 +117,9 @@ jobs:
If you'd like to force a timeout of your workflow pause, you can specify `timeout-minutes` at either the [step](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepstimeout-minutes) level or the [job](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idtimeout-minutes) level.
> **Note:** The `timeout-minutes` option has been removed from the `manual-approval` inputs, as it did nothing and incorrectly assured users that they were in fact
> [!Note]
>
> The `timeout-minutes` option has been removed from the `manual-approval` inputs, as it did nothing and incorrectly assured users that they were in fact
> getting timeout behavior. Please use one of the below two approaches instead.
>
> If you are currently using `timeout-minutes` as a `manual-approval` input, you may see a warning, but this will not break your action.
@ -198,11 +209,10 @@ For `uses`, this should point to your repo and dev branch.
### Create a release
1. Build the new version's image: `$ VERSION=1.7.0 make build`
2. Push the new image: `$ VERSION=1.7.0 make push`
3. Create a release branch and modify `action.yaml` to point to the new image
4. Open and merge a PR to add these changes to the default branch
5. Make sure to fetch the new changes into your local repo: `$ git checkout main && git fetch origin && git merge origin main`
6. Delete the `v1` tag locally and remotely: `$ git tag -d v1 && git push --delete origin v1`
7. Create and push new tags: `$ git tag v1.7.0 && git tag v1 && git push origin --tags`
8. Create the GitHub project release
1. Build and push the new image: `$ VERSION=1.7.0 make build_push`
2. Create a release branch and modify `action.yaml` to point to the new image
3. Open and merge a PR to add these changes to the default branch
4. Make sure to fetch the new changes into your local repo: `$ git checkout main && git fetch origin && git merge origin main`
5. Delete the `v1` tag locally and remotely: `$ git tag -d v1 && git push --delete origin v1`
6. Create and push new tags: `$ git tag v1.7.0 && git tag v1 && git push origin --tags`
7. Create the GitHub project release

View file

@ -127,11 +127,13 @@ func (a *approvalEnvironment) SetActionOutputs(outputs map[string]string) (bool,
}
f, err := os.OpenFile(outputFile, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
return false, err
}
defer f.Close()
defer func() {
_ = f.Close() // Error explicitly ignored as there is nothing to handle if file close fails.
}()
var pairs []string

View file

@ -467,7 +467,7 @@ func TestSaveOutput(t *testing.T) {
for _, testCase := range testCases {
t.Run(testCase.name, func(t *testing.T) {
os.Setenv("GITHUB_OUTPUT", testCase.env_github_output)
t.Setenv("GITHUB_OUTPUT", testCase.env_github_output)
a := approvalEnvironment{
client: nil,
repoFullName: "",
@ -481,7 +481,10 @@ func TestSaveOutput(t *testing.T) {
minimumApprovals: 0,
}
os.Remove(testCase.env_github_output)
if err := os.Remove(testCase.env_github_output); err != nil && !os.IsNotExist(err) {
t.Fatalf("failed to remove file: %v", err)
}
actual, err := a.SetActionOutputs(nil)
if err != nil {

10
go.mod
View file

@ -1,17 +1,13 @@
module github.com/trstringer/manual-approval
go 1.17
go 1.24
require (
github.com/google/go-github/v43 v43.0.0
golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a
golang.org/x/oauth2 v0.30.0
)
require (
github.com/golang/protobuf v1.4.2 // indirect
github.com/google/go-querystring v1.1.0 // indirect
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.25.0 // indirect
golang.org/x/crypto v0.35.0 // indirect
)