Skip to content

Commit

Permalink
Improve Go and GitHub action examples (#373)
Browse files Browse the repository at this point in the history
  • Loading branch information
sverdlov93 authored Sep 20, 2023
1 parent 07f1bb9 commit 0da7660
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 13 deletions.
17 changes: 14 additions & 3 deletions github-action-examples/simple-github-action-example/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,24 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Setup JFrog CLI
uses: jfrog/setup-jfrog-cli@v2
uses: jfrog/setup-jfrog-cli@v3
env:
JF_ENV_1: ${{ secrets.JF_SECRET_ENV_1 }}
# JFrog platform url (for example: https://acme.jfrog.io)
JF_URL: ${{ secrets.JF_URL }}

# JFrog Platform access token
JF_ACCESS_TOKEN: ${{ secrets.JF_ACCESS_TOKEN }}

# Basic authentication credentials
## JF_USER: ${{ secrets.JF_USER }}
## JF_PASSWORD: ${{ secrets.JF_PASSWORD }}

- name: Run JFrog CLI
run: |
# Ping the server
jf rt ping
# Collect environment variables for the build
jf rt bce
# Collect VCS details from git and add them to the build
Expand Down
2 changes: 1 addition & 1 deletion golang-example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ To work with Go repositories you need to use [JFrog CLI](https://www.jfrog.com/c
* Make sure the **go** command is in your PATH.
* Install [JFrog CLI](https://jfrog.com/getcli/)
* Make sure your Artifactory version is 5.11.0 or above
* Make sure your JFrog CLI version is 1.26.0 or above
* Make sure your JFrog CLI version is 2.0.0 or above

## Running the Example
'cd' to the root project directory
Expand Down
10 changes: 10 additions & 0 deletions golang-example/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module github.com/you/hello

go 1.20

require rsc.io/quote v1.5.2

require (
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c // indirect
rsc.io/sampler v1.3.0 // indirect
)
File renamed without changes.
2 changes: 1 addition & 1 deletion golang-example/hello/hello.go → golang-example/hello.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main // import "github.com/you/hello"
package main

import (
"fmt"
Expand Down
3 changes: 0 additions & 3 deletions golang-example/hello/go.mod

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pipeline {
stage ('Exec Go run') {
steps {
rtGoRun (
path: "golang-example/hello",
path: "golang-example",
resolverId: "GO_RESOLVER",
args: "build"
)
Expand All @@ -43,7 +43,7 @@ pipeline {
stage ('Exec Go publish') {
steps {
rtGoPublish (
path: "golang-example/hello",
path: "golang-example",
deployerId: "GO_DEPLOYER",
version: "1.0.0"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ node {
}

stage ('Go run') {
rtGo.run buildInfo: buildInfo, path: 'golang-example/hello', args: 'build'
rtGo.run buildInfo: buildInfo, path: 'golang-example', args: 'build'
}

stage ('Go publish') {
rtGo.publish buildInfo: buildInfo, path: 'golang-example/hello', version: '1.0.0'
rtGo.publish buildInfo: buildInfo, path: 'golang-example', version: '1.0.0'
}

stage ('Publish build info') {
Expand Down
2 changes: 1 addition & 1 deletion npm-example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ For more details on npm build integration using JFrog CLI, please refer to [Buil

## This Example

This example demonstrates how to build an npm project using JFrog CLI. The build does the following:
This example demonstrates how to build a npm project using JFrog CLI. The build does the following:

1. Downloads its npm dependencies from Artifactory.
2. Packs and uploads the built package to Artifactory.
Expand Down

0 comments on commit 0da7660

Please sign in to comment.