Skip to content

Commit

Permalink
Add goreleaser github action. Fix some issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
marianogappa committed Jun 23, 2024
1 parent 1c47f3e commit 6b4d765
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 17 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Release

on:
push:
branches:
- main

jobs:
release:
name: Release with GoReleaser
runs-on: ubuntu-latest

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

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.22.3'

- name: Install GoReleaser
run: |
curl -sSfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sh
- name: Calculate next minor version
id: next-version
run: |
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
major=$(echo $latest_tag | cut -d'.' -f1)
minor=$(echo $latest_tag | cut -d'.' -f2)
new_minor=$((minor + 1))
echo "next_version=${major}.${new_minor}.0" >> $GITHUB_ENV
- name: Create tag
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git tag ${{ env.next_version }}
git push origin ${{ env.next_version }}
- name: Run GoReleaser
run: goreleaser release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 0 additions & 6 deletions truco/action_son_buenas.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@ func (a ActionSaySonBuenas) Run(g *GameState) error {
if err != nil {
return err
}
curPlayerEnvidoScore := g.Hands[g.CurrentPlayerID()].EnvidoScore()
oppPlayerEnvidoScore := g.Hands[g.OpponentPlayerID()].EnvidoScore()
g.ValidSonBuenas = true
if curPlayerEnvidoScore > oppPlayerEnvidoScore || (curPlayerEnvidoScore == oppPlayerEnvidoScore && g.TurnPlayerID == g.CurrentPlayerID()) {
g.ValidSonBuenas = false
}
g.CurrentRoundResult.EnvidoPoints = cost
g.CurrentRoundResult.EnvidoWinnerPlayerID = g.OpponentOf(g.CurrentPlayerID())
g.EnvidoWinnerPlayerID = g.OpponentOf(g.CurrentPlayerID())
Expand Down
6 changes: 0 additions & 6 deletions truco/action_son_mejores.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ func (a ActionSaySonMejores) Run(g *GameState) error {
if err != nil {
return err
}
curPlayerEnvidoScore := g.Hands[g.CurrentPlayerID()].EnvidoScore()
oppPlayerEnvidoScore := g.Hands[g.OpponentPlayerID()].EnvidoScore()
g.ValidSonMejores = true
if curPlayerEnvidoScore < oppPlayerEnvidoScore || (curPlayerEnvidoScore == oppPlayerEnvidoScore && g.TurnPlayerID == g.OpponentPlayerID()) {
g.ValidSonMejores = false
}
g.CurrentRoundResult.EnvidoPoints = cost
g.CurrentRoundResult.EnvidoWinnerPlayerID = g.OpponentOf(g.CurrentPlayerID())
g.EnvidoWinnerPlayerID = g.CurrentPlayerID()
Expand Down
4 changes: 0 additions & 4 deletions truco/truco.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ type GameState struct {
CardRevealSequence *CardRevealSequence `json:"cardRevealSequence"`
EnvidoFinished bool `json:"envidoFinished"`
EnvidoWinnerPlayerID int `json:"envidoWinnerPlayerID"`
ValidSonBuenas bool `json:"validSonBuenas"`
ValidSonMejores bool `json:"validSonMejores"`
RoundFinished bool `json:"roundFinished"`
IsEnded bool `json:"isEnded"`
WinnerPlayerID int `json:"winnerPlayerID"`
Expand Down Expand Up @@ -89,8 +87,6 @@ func (g *GameState) StartNewRound() {
g.TrucoSequence = &TrucoSequence{}
g.CardRevealSequence = &CardRevealSequence{}
g.EnvidoFinished = false
g.ValidSonBuenas = true
g.ValidSonMejores = true
g.RoundFinished = false
g.TrucoQuieroOwnerPlayerId = -1
g.PossibleActions = g.CalculatePossibleActions()
Expand Down
2 changes: 1 addition & 1 deletion ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ func getCardsString(cards []truco.Card, withNumbers bool, withBack bool) string
}
}
if withBack {
cs = append(cs, "0 Volver")
cs = append(cs, "0. Volver")
}
return strings.Join(cs, " ")
}
Expand Down

0 comments on commit 6b4d765

Please sign in to comment.