Skip to content

Commit

Permalink
Merge pull request #6 from arribada/cleanup
Browse files Browse the repository at this point in the history
gh actions cleanup
  • Loading branch information
mpl authored Jun 27, 2024
2 parents 3158fb4 + f65cfb2 commit 7b7be9b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 39 deletions.
1 change: 0 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ jobs:
balena_cloud_build:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
arch: [aarch64, amd64, armv7hf]

Expand Down
36 changes: 0 additions & 36 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,44 +11,9 @@ on:
default: ""

jobs:
ghr:
runs-on: ubuntu-latest
if: github.event_name == 'push'

steps:
- name: checkout
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Log-in to ghcr.io
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login https://ghcr.io -u ${{ github.actor }} --password-stdin

- name: Build and push container image
run: |
IMAGE_ID=$(echo ghcr.io/${{ github.repository }} | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# when the branch is master, replace master with latest
[ "$VERSION" == "master" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
# Build and Publish container image
docker buildx build --push \
--tag $IMAGE_ID:$VERSION \
--platform linux/amd64,linux/arm64,linux/armv7hf ./notecard
balena_cloud_build:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
arch: [aarch64, amd64, armv7hf]

Expand All @@ -59,7 +24,6 @@ jobs:
with:
balena_token: ${{ secrets.BALENA_TOKEN }}
fleet: arribada/notecard-go-${{ matrix.arch }}
create_tag: true
- name: Log release ID built
run: echo "Built release ID ${{ steps.build.outputs.release_id }}"

Expand Down
5 changes: 3 additions & 2 deletions notecard/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func handleError(w http.ResponseWriter, err error, msg string) {
}

func (s *server) ServeHTTP(w http.ResponseWriter, req *http.Request) {
if s.card == nil || s.initError != nil {
if s.initError != nil {
handleError(w, s.initError, "while initialising notecard")
log.Fatal("Notecard not initialised, exiting...")
}
Expand Down Expand Up @@ -101,8 +101,9 @@ func main() {
card, err := setupNotecard(transport)
if err != nil {
log.Printf("while setting up notecard: %v", err)
} else {
defer card.Close()
}
defer card.Close()

http.Handle("/", &server{card: card, initError: err})
http.ListenAndServe(":3434", nil)
Expand Down

0 comments on commit 7b7be9b

Please sign in to comment.