diff --git a/.github/workflows/setup-go.yaml b/.github/workflows/setup-go.yaml new file mode 100644 index 0000000..dce0133 --- /dev/null +++ b/.github/workflows/setup-go.yaml @@ -0,0 +1,52 @@ +name: Test setup-go Actions +run-name: ${{ github.actor }} is testing out Github Actions 🚀 + +on: + push: + branches: + - "main" + +jobs: + Explore-Actions: + runs-on: ubuntu-latest + container: + image: catthehacker/ubuntu:act-latest + steps: + - + name: Show details + run: | + echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Github!" + echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." + - + name: Checkout repository code + uses: actions/checkout@v4 + - + name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - + name: List files in the repository + run: | + echo "💡 The ${{ github.repository }} repository has been cloned to the runner." + echo "🖥️ The workflow is now ready to test your code on the runner." + ls ${{ github.workspace }} + - + name: Setup golang + uses: actions/setup-go@v4 + with: + go-version: '>=1.21.0' + - + name: Run golang scripts + run: | + go env -w GOPROXY='https://goproxy.cn,direct' + go env + go run cmd/helloworld/main.go + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - + name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} \ No newline at end of file diff --git a/cmd/helloworld/main.go b/cmd/helloworld/main.go new file mode 100644 index 0000000..70a7fe5 --- /dev/null +++ b/cmd/helloworld/main.go @@ -0,0 +1,7 @@ +package main + +import "fmt" + +func main() { + fmt.Println("Hello world!") +}