diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..b38cd4b --- /dev/null +++ b/.github/workflows/release.yml @@ -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 }} diff --git a/truco/action_son_buenas.go b/truco/action_son_buenas.go index 1e26673..df7d6e7 100644 --- a/truco/action_son_buenas.go +++ b/truco/action_son_buenas.go @@ -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()) diff --git a/truco/action_son_mejores.go b/truco/action_son_mejores.go index 9b9052e..afd04da 100644 --- a/truco/action_son_mejores.go +++ b/truco/action_son_mejores.go @@ -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() diff --git a/truco/truco.go b/truco/truco.go index dc1a2f1..c51c877 100644 --- a/truco/truco.go +++ b/truco/truco.go @@ -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"` @@ -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() diff --git a/ui.go b/ui.go index ba896ae..21716ed 100644 --- a/ui.go +++ b/ui.go @@ -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, " ") }