Skip to content

Commit

Permalink
chore: set default values and fix permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
vic3lord committed Oct 22, 2024
1 parent 1e9a87b commit a1144d8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on: [push]
jobs:
pipeline:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -14,4 +16,5 @@ jobs:

- name: Dagger pipeline
run: go run ./build

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 3 additions & 2 deletions build/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"cmp"
"context"
"flag"
"fmt"
Expand Down Expand Up @@ -37,10 +38,10 @@ func Task(name string) func(ctr *dagger.Container) *dagger.Container {
}

func Publish(ctx context.Context, dag *dagger.Client, ctr *dagger.Container) (string, error) {
user := os.Getenv("GITHUB_ACTOR")
user := cmp.Or(os.Getenv("GITHUB_ACTOR"), "github-actions")
pass := dag.SetSecret("GITHUB_TOKEN", os.Getenv("GITHUB_TOKEN"))
registry := "ghcr.io"
image := fmt.Sprintf("%s/%s", registry, os.Getenv("GITHUB_REPOSITORY"))
image := fmt.Sprintf("%s/%s", registry, cmp.Or(os.Getenv("GITHUB_REPOSITORY"), "bufile"))
return dag.Container().
From("gcr.io/distroless/static").
WithFile("/bufile", ctr.File("/src/bufile")).
Expand Down

0 comments on commit a1144d8

Please sign in to comment.